I am using SonarQube 5.4 and am investigating the suppression of several problems. I found that SonarQube does not detect rule suppression. Source files should not have duplicate blocks after I insert @SuppressWarnings("common-java:DuplicatedBlocks") at the beginning of the file (the file does not compile) or on the markup of one of the duplicated code blocks.
I found the information at http://docs.sonarqube.org/display/PLUG/Java+FAQ which states the following:
The // NOSONAR tag is useful for deactivating all rules in a given line, but is not suitable for deactivating all rules (or only a given rule) for all lines of a method or class. That's why support for SonarQube was added to support @SuppressWarnings ("all").
I am using version 3.13.1 of the SonarQube Java plugin.
I know that I can mark a problem in the SonarQube GUI as a false positive, but this will not be transmitted through branches, which is a mandatory function for me.
How to use @SuppressWarnings -tag to disable duplicate code block?
source share