Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between coverage_exclusions vs exclusions in sonar?

What is the difference between coverage_exclusions vs exclusions in sonar? example:

"sonar": {
    "exclusions": "gulpfile.js, ...",
    "coverage_exclusions": "gulpfile.js, ..., server/models/*.js",
    "quality_gate": "...",
    "server_id": "SONAR-main"
  },
like image 767
Sohail Si Avatar asked Feb 28 '19 10:02

Sohail Si


People also ask

What is SonarQube coverage and sonar exclusions?

sonar.exclusions and sonar.coverage.exclusions are standard property names for SonarQube. I don't know how the tool you use feeds these properties to the analysis based on your configuration file. Thanks for contributing an answer to Stack Overflow!

What are the different types of sonar file exclusions?

Source File Exclusions ( sonar.exclusions) - to exclude source code files. Test File Exclusions ( sonar.test.exclusions) - to exclude test files. The vast majority of needs are met simply by setting sonar.sources carefully. Most other needs are met with the addition of a few simple exclusions.

How to limit the scope of sonar analysis?

Set the sonar.sources property to limit the scope of the analysis to certain directories. For most languages, you can restrict the scope of analysis to files matching a set of extensions. Go to Project Settings > General Settings > [Language] to set the File suffixes property.

Is there a way to disable sonar analysis for specific directories?

This behavior can be disabled. See sonar.scm.exclusions.disabled in the Analysis Parameters page for details. Set the sonar.sources property to limit the scope of the analysis to certain directories. For most languages, you can restrict the scope of analysis to files matching a set of extensions.


1 Answers

sonar.coverage.exclusions excludes some files from the test coverage metrics but those files are still analyzed: other metrics, duplications, coding rules...

sonar.exclusions completely excludes some files from the analysis: those files don't appear at all in SonarQube.

See https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/

sonar.exclusions and sonar.coverage.exclusions are standard property names for SonarQube. I don't know how the tool you use feeds these properties to the analysis based on your configuration file.

like image 178
Pierre-Yves Avatar answered Sep 19 '22 14:09

Pierre-Yves