Details
Description
The //NOSONAR tag is useful to deactivate all rules at a given line but is not suitable to deactivate all rules (or only a given rule) for all the lines of a method or a class.
In that case, the use of the @SuppressWarnings would perfectly fit the needs.
The excepted value to deactivate all rules would be :
@SuppressWarnings("all") //which is pretty standard
The excepted value to deactivate only one rule or a list of rules would be :
@SuppressWarnings("MY_RULE_KEY") @SuppressWarnings({"MY_RULE_KEY1","MY_RULE_KEY2})
Issue Links
- is depended upon by
-
SONARJAVA-57
Add rule key as parameters of the Java annotation @SuppressWarnings
-
-
SONARJAVA-76
Add an option to automatically exclude "@deprecated" method from Sonar analysis (violations, lcom4, ...)
-
-
SONARJAVA-71
Support for @Generated annotation
-
- is duplicated by
-
SONAR-1407
Apply NOSONAR to a block of code
-
-
SONAR-1796
Manage an Annotation @SonarRuleIgnore to avoid checking rules on particular lines
-
- is related to
-
SONAR-2755
Support @SuppressWarnings("MY_RULE_KEY") and @SuppressWarnings({"MY_RULE_KEY1","MY_RULE_KEY2})
-
-
SONARJAVA-78
UnusedPrivateMethod should read @SuppressWarnings("unused") metadata
-
Together with Freddy we decided that as first step we must support only
@SuppressWarnings("all"), so done in r6048.
Also note that this annotation disables all violations, even produced by Checkstyle rule SuppressWarnings, but not new Squid rule (
SONAR-1817). So maybe we should create analogue of this rule, but for annotation.