Skip to content

Preventing rules from being suppressed #4890

Answered by schalkms
gfreivasc asked this question in Q&A
Discussion options

You must be logged in to vote

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:

SuppressionViolation:
  active: true
  forRules: ["MagicNumber", ...]

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…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@schalkms
Comment options

@BraisGabin
Comment options

@schalkms
Comment options

@gfreivasc
Comment options

@schalkms
Comment options

Answer selected by gfreivasc
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants