SonarQube Exclude a directory

I am trying to exclude a directory from being analyzed by Sonar. I have the following properties defined in my sonar-project.properties file: sonar.sources=src/java sonar.exclusions=src/java/test/****/*.java The directory structure I have is: src/java/dig src/java/test/dig When I run the sonar-runner I get the following info: INFO – Excluded sources: INFO – src/java/test/**/*.java INFO – Excluded tests: INFO – … Read more

Turning Sonar off for certain code

Is it possible to turn off sonar (www.sonarsource.org) measurements for specific blocks of code, which one doesn’t want to be measured? An example is the “Preserve Stack Trace” warning which Findbugs outputs. When leaving the server, I might well want to only pass the message back to the client, not including the actual exception which … Read more

Hide Utility Class Constructor : Utility classes should not have a public or default constructor

If this class is only a utility class, you should make the class final and define a private constructor: public final class FilePathHelper { private FilePathHelper() { //not called } } This prevents the default parameter-less constructor from being used elsewhere in your code. Additionally, you can make the class final, so that it can’t … Read more