Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

[BUG] format-comment false positive #1232

Open
1 task
FMorschel opened this issue May 15, 2023 · 3 comments
Open
1 task

[BUG] format-comment false positive #1232

FMorschel opened this issue May 15, 2023 · 3 comments
Assignees
Labels
type: bug Something isn't working

Comments

@FMorschel
Copy link

Environment and configuration

DCM version: 5.7.3
Dart SDK version: 3.0.0

Configuration
dart_code_metrics:
  rules:
    - double-literal-format
    - format-comment
    - member-ordering-extended:
        alphabetize: false
        order:
          - constructors
          - named-constructors
          - factory-constructors
          - static-getters-setters
          - static-const-public-fields
          - static-const-private-fields
          - static-final-public-fields
          - static-final-private-fields
          - static-late-final-public-fields
          - static-late-final-private-fields
          - static-late-public-fields
          - static-late-private-fields
          - static-public-fields
          - static-private-fields
          - const-public-fields
          - const-private-fields
          - final-public-fields
          - final-private-fields
          - late-final-public-fields
          - late-final-private-fields
          - late-public-fields
          - late-private-fields
          - public-fields
          - private-fields
          - overridden-public-fields
          - overriden-public-methods
          - static-public-methods
          - static-private-methods
          - public-methods
          - private-methods
          - getters-setters
    - prefer-commenting-analyzer-ignores
    - prefer-first
    - prefer-immediate-return
    - prefer-last

    - always-remove-listener
    - avoid-border-all
    - avoid-returning-widgets:
        ignored-names:
          - testFunction
        ignored-annotations:
          - allowedAnnotation
    - avoid-unnecessary-setstate
    - avoid-wrapping-in-padding
    - prefer-const-border-radius

What did you do?

  // TODO: home.
  // TODO: login.

What did you expect to happen?

No line should trigger since I'm actually formatting them like sentences.

What actually happened?

When I have two lines of comment one after another, this lint triggers. When there is only one, the lint doesn't trigger.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

@FMorschel FMorschel added the type: bug Something isn't working label May 15, 2023
@incendial
Copy link
Member

incendial commented May 15, 2023

@FMorschel for multiline comments the rule treats TODO: as separate parts of the sentences (which is probably incorrect) and expects an uppercase letter to be the first after the :.

So this version won't trigger the lint:

// TODO: Home.
// TODO: Login.

@incendial
Copy link
Member

The more I look at various examples of todos, the more I'm not sure whether any change should be done here. Most of them start with the uppercase after :.

@FMorschel and you expected for the rule to accept a lowercase letter as the first sentence letter?

@FMorschel
Copy link
Author

Yes, but obviously this is just team standards. This could be solved by, for example, the lint warning about that. That would make us self aware and we could solve that by simply changing the first letter. If we are willing to use DCM, we should be considered of it's boundaries.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants