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

feat: Add the option ignored-patterns to the rule format-comment #828

Conversation

ValentinVignal
Copy link
Contributor

@ValentinVignal ValentinVignal commented May 4, 2022

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix
[ ] New rule
[x] Changes an existing rule
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

Should close #826

What changes did you make? (Give an overview)

I added the option ignored-patterns (a list of strings that will be used as regexes) to the rule format-comment to be able to ignore some kind of comments.

Is there anything you'd like reviewers to focus on?

Am I correctly getting the ignored-patterns option from the config ? I didn't find how to test it myself (e2e test) and make sure my code is actually working.

Also, do I have to apply any change to your web site? If yes, how?

Copy link
Member

@incendial incendial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this option!

Am I correctly getting the ignored-patterns option from the config

Yes, every thing is fine, but I left few small comments just to keep the codebase in the same code style. Could you address them?

@@ -11,6 +11,10 @@ const _ignoreExp = 'ignore:';
const _ignoreForFileExp = 'ignore_for_file:';

class _Visitor extends RecursiveAstVisitor<void> {
_Visitor(this._ignoredPatterns);

final Iterable<RegExp> _ignoredPatterns;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the variables in this commit: 5ef8885

@incendial incendial added type: enhancement New feature or request area-rules labels May 4, 2022
@incendial incendial added this to the 4.16.0 milestone May 4, 2022
@ValentinVignal
Copy link
Contributor Author

To update the website, you need to change this file https://github.com/dart-code-checker/dart-code-metrics/blob/master/website/docs/rules/common/format-comment.md. Here is an example https://github.com/dart-code-checker/dart-code-metrics/blob/master/website/docs/rules/common/no-equal-arguments.md

Please also add the configurable label to this rule in https://github.com/dart-code-checker/dart-code-metrics/blob/master/website/docs/rules/overview.md

I updated the documentation in this commit: 6288e6f

Tell me if this is too specific/not good enough

@ValentinVignal ValentinVignal changed the title Add the option ignored-patterns to the rule format-comment feat: Add the option ignored-patterns to the rule format-comment May 5, 2022
Copy link
Member

@incendial incendial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@codecov
Copy link

codecov bot commented May 5, 2022

Codecov Report

Merging #828 (aa8d055) into master (f6758f9) will increase coverage by 0.08%.
The diff coverage is 100.00%.

❗ Current head aa8d055 differs from pull request most recent head ccb5130. Consider uploading reports for the commit ccb5130 to get more accurate results

@@            Coverage Diff             @@
##           master     #828      +/-   ##
==========================================
+ Coverage   87.25%   87.34%   +0.08%     
==========================================
  Files         279      280       +1     
  Lines        5932     5941       +9     
==========================================
+ Hits         5176     5189      +13     
+ Misses        756      752       -4     
Impacted Files Coverage Δ
...rules/rules_list/format_comment/config_parser.dart 100.00% <100.00%> (ø)
...rules_list/format_comment/format_comment_rule.dart 87.87% <100.00%> (+0.37%) ⬆️
...lyzer/rules/rules_list/format_comment/visitor.dart 100.00% <100.00%> (ø)
...metrics/metrics_list/number_of_methods_metric.dart 100.00% <0.00%> (+17.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b09a55...ccb5130. Read the comment docs.

@dkrutskikh dkrutskikh merged commit 29be54e into dart-code-checker:master May 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-rules type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] Is it possible to disable the rule format-comment for some patterns (ex regexp) ?
4 participants