If SonarQube provides developers information with too much noise (Issues on generated code => Indeed, it is useless to analyze such code as you don't have any way to fix issues that would be raised, Issues that are not relevant in the context => For example, you may want to allow the usage of hard coded values for some objects, but you still want to forbid this usage everywhere else, etc.), they'll likely push back the tool. That's why configuring Exclusions / Inclusions is an important step when setting up a project into SonarQube.
Exclusions on Files
Properly set the
sonar.sources property to limit source code analysis to what the team can work on (do not analyze third-party tools source code for example).
Each language plugin offers a way to restrict analysis to files matching a set of extensions. Go to Settings > General Settings > LanguagePlugin and set the
It is possible to exclude some specific files from being analyzed. At project level, go to Configuration > Settings > Exclusions and set the:
sonar.exclusionsproperty to exclude source code files
sonar.tests.exclusionsproperty to exclude unit test files
Global exclusions that will apply to all projects can also be set. Go to Settings > General Settings > Exclusions and set the
Since version 3.5, you can also work the other way around by setting inclusions. Go to Settings > General Settings > Exclusions and set the
Full documentation is available directly in the SonarQube web interface (Configuration > Settings > Exclusions).
Exclusions on Coding Rules
Exclusions on Duplications
- Exclude some files from being checked against duplications. To do so, set the
sonar.cpd.exclusionsproperty (Configuration > Settings > Duplications).