sonar.exclusionsproperty to exclude source code files
sonar.teststest.exclusionsproperty to exclude unit test files
Global exclusions that will apply to all projects can also be set. Go to Settings > General Settings > Exclusions > Files and set the
Since version 3.5, you can also work the other way around by setting inclusions. Go to Settings > General Settings > Exclusions > Files and set the
sonar.test.inclusions properties. If you set an inclusion, then only the files or modules listed there will be included in the analysis.