I am using SonarQube 5.4 and investigating the suppressing of several issues. I've found that SonarQube does not detect the suppression of the rule Source files should not have any duplicated blocks once I insert @SuppressWarnings("common-java:DuplicatedBlocks")
in the beginning of the file (the file does not compile) or at the markup of the one of the duplicated code blocks.
I've found the information at http://docs.sonarqube.org/display/PLUG/Java+FAQ which states the following:
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. This is why support for @SuppressWarnings("all") has been added to SonarQube.
I am using the version 3.13.1 of SonarQube Java Plugin.
I am aware that I can mark the issue in the SonarQube GUI as a false positive but this will not transfer through branches which is a required feature for me.
How should I use the @SuppressWarnings
-tag to disable the duplicated code block?
For the other measures your should: Logon to SonarQube with your browser. Open the developer tools (hit <F12> on your keyboard) Browse to the page in SonarQube and monitor the request in the Developer Tools.
This is a feature that is not supported : https://jira.sonarsource.com/browse/SONARJAVA-521
There is no plan to implement it for now but this might be addressed in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With