I asked a similar question a while ago: sonarqube 4.2 and lombok
Basically, you can no longer do this with annotations (e.g. @SuppressWarnings) in your code. Instead, you need to configure a rule exception (global) in SonarQube:
Click Settings → Exceptions → Problems and adding entries in the “Ignore problems in multiple criteria” section and enter something like:
Rule Key Pattern File Path Pattern squid:S1068 **/models/**/*.java
This makes your source code a little cleaner (since you no longer need @SuppressWarnings), but I don't like the idea of setting global rules, as this can cause other problems.
Update:
For the "excess nullcheck value known as non-null", you can add something like the following:
Rule Key Pattern File Path Pattern findbugs:RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE **/xxxxx.java
And one more that may (or may be) useful to you:
Rule Key Pattern File Path Pattern common-java:InsufficientBranchCoverage **/models/**/*.java
su-
source share