Reputation: 26549
I am playing around with the ready to use Sonarqube Version 6.2
and sonar scanner
with a sonar-project.properties
file based on the tutorial @ https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner .
I am curious about the exclusions. I am still using the embedded databases (not a full install), and I have gone to Administration>Configuration>Exclusions and set the following converage exclusions
- **/*.js
, and **/target/**
.
However when I run the project through sonar scanner
the JS files are still being analyzed.
I saw on another page in an archive that there is a properties file parameter sonar.exclusions
.
Question: Does sonar respect the general settings > Analysis scope when analyzing through the scanner or should I use the project properties file?
What is the proper approach?
Upvotes: 1
Views: 8092
Reputation: 694
We can also exclude the files using maven.
<properties>
<sonar.exclusions>org/binarytherapy/generated/**/*,
Mostly we use the following(I recomend this approach) Administration > General Settings > Analysis Scope > Files
In rare cases we use sonar-project.properties for exclusions.
references: Configure Sonar to exclude files from Maven pom.xml https://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus
Upvotes: 2
Reputation: 3983
Code coverage exclusions are useful when you want to exclude some files from being taken into account in code coverage computation by unit tests.
What you want to achieve is to completely exclude some files from the analysis. Thus you should have a look at file exclusions (it's just the section below code coverage).
Upvotes: 3