I recommend you try to suppress specific warnings by using @SuppressWarnings("squid:S2078")
.
For suppressing multiple warnings you can do it like this @SuppressWarnings({"squid:S2078", "squid:S2076"})
There is also the //NOSONAR
comment that tells SonarQube to ignore all errors for a specific line.
Finally if you have the proper rights for the user interface you can issue a flag as a false positive directly from the interface.
The reason why I recommend suppression of specific warnings is that it's a better practice to block a specific issue instead of using //NOSONAR
and risk a Sonar issue creeping in your code by accident.
You can read more about this in the FAQ
Edit: 6/30/16
SonarQube is now called SonarLint
In case you are wondering how to find the squid number. Just click on the Sonar message (ex. Remove this method to simply inherit it.
) and the Sonar issue will expand.
On the bottom left it will have the squid number (ex. squid:S1185
Maintainability > Understandability)
So then you can suppress it by @SuppressWarnings("squid:S1185")
@SuppressFBWarnings
(added to avoid clashes withjava.lang.SuppressWarnings
) and also ignores it. – Salaam