-
-
Notifications
You must be signed in to change notification settings - Fork 755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False negative ForbiddenComment with common TODO markers #6116
Comments
duplicate #3508 ? |
I like the idea but that regex is scary. I don't think that such a difficult regex should be part of the default configuration of detekt. Nearly no one will be brave to edit it. I think that #6075 could help to fix this. |
This comment was marked as outdated.
This comment was marked as outdated.
What do we think about this? A change in our default configuration is not a breaking change so we can make the change propesed by @TWiStErRob and if in the end we implement #6075 we can change it again at any moment. I would approve a PR doing this change. |
I'm happy to write some docs on the rule on what the regex parts mean (in addition to a link to https://regex101.com/r/IEOm2Q/1). And I think even some programmer without any knowledge of RegEx would be able to figure out how to add/remove their own custom todo markers based on pattern recognition. |
Go for it :) |
This issue is stale because it has been open 90 days with no activity. Please comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
The power of
ForbiddenComment
is increased with #5981 and therefore we can decrease the false negatives, while not introducing new false positives.Expected Behavior
Flag all of:
and by extension
(French grammar mandates a space before the
:
so this is common by French speakers; I've seen it from French and Moroccan coders.)Potentially these too:
All of the above can be achieved by using a regex:
(?i)\bTODO\b
similar to IDEA config. The\b
is extra to make sureTODOs
,mastodon
,affixment
words in comments are not flagged.Additionally I suggest to merge the three comments into one (again this comes as a bonus of #5981 giving more power):
so that it's easier to configure the rule (no need to copy/paste and maintain 3 rules when adding new).
Observed Behavior
These are flagged:
nothing else.
Steps to Reproduce
Use comments in "Expected Behavior" with default Detekt config.
detekt/detekt-core/src/main/resources/default-detekt-config.yml
Lines 575 to 578 in 67d2c72
Context
While working on #5981 (comment) I realized
// FIXME foo
would just be accepted compliant byForbiddenComment
rule. From experience with multiple codebases most of the TODOs developers write don't contain the colon (:
) character.Note: the default todo markers in IntelliJ IDEA also don't use
:
https://www.jetbrains.com/help/idea/using-todo.html#add_pattern_filter_todo
Your Environment
--scan
option when running the gradle task): N/AThe text was updated successfully, but these errors were encountered: