-
I'm seeing a situation arise where some files in a code base I work on are being pushed with i.e.: We have This is one rule which I'd be totally fine with disallowing suppression altogether. In the few (but possible) files where we'd want to ignore it, we could manually exclude it in the config YML instead, to further discourage it. My question is: is there a way to prevent specific rules from being suppressed? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
You could actually write a detekt rule, which detects The rule could look like this, for instance: SuppressionViolation:
active: true
forRules: ["MagicNumber", ...] This idea sounds awesome. However, a seasoned detekt user could suppress the rule, which exactly flags this suppression. 😉 What do you think about this idea? @gfreivasc It should be easy to implement this rule, since you could check this repo, which includes many rules that check annotations. |
Beta Was this translation helpful? Give feedback.
-
Really great topic! I had/have similar sitiations here are my 2 cents: This is not something that detekt nor other tool can fix. It's part of the team culture. This are the tings that I do to prevent or lower this things:
They are some random ideas. Sorry they aren't well structured but I hope that some of them could help you :) |
Beta Was this translation helpful? Give feedback.
You could actually write a detekt rule, which detects
Suppress
annotations for given rules.This new detekt rule could even include a config option passing the rule names.
With that in place, this new rule flags suppressions for the passed rule names.
The rule could look like this, for instance:
This idea sounds awesome. However, a seasoned detekt user could suppress the rule, which exactly flags this suppression. 😉
This case could maybe be prevented in my opinion.
What do you think about this idea? @gfreivasc
It should be easy to implement this rule, since you could check this repo, which includes many rules that chec…