Verifying the analysis scope of a project
This section explains how to verify the configured properties and the properties read by the scanner to compute the project's analysis scope.
Verifying the analysis scope properties configured for the project
This procedure allows you to view the properties configured in the different possible locations on the CI/CD host and in SonarQube Community Build UI for a given analysis run. It does not indicate which properties have been processed by the scanner.
To verify the configured analysis properties for a project:
- Run the project analysis.
- The analysis debug logs show which source and test files are indexed for the analysis (the scanner logs out to the place it was invoked from).
If the analysis fails with the errorFile <fileName> can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
then it means that the indicated file is defined in your analysis scope as both source (non-test) and test file. In this case, you must correct your analysis scope. - You can also verify all the project's exclusion parameters. To do so, proceed as follows:
- In SonarQube Community Build UI, retrieve the project.
- Go to Project Settings > Background Tasks.
- In the list, locate the project run you want to verify and click the three-dot menu in the far right column.
- In the contextual menu, select Show SonarScanner Context. The scanner context is shown:
- The Global server settings section shows the analysis parameters set in the UI at the global level.
- The Project server settings section shows the analysis parameters set in the UI for the project.
- The Project scanner properties section shows the analysis parameters set on the CI/CD host for the project.
Any property set on the CI/CD host and identified by the scanner as a sonar property (that means, with a key starting with sonar.
) will be listed as a scanner property even if the scanner does not know about it (in that case, the scanner will just ignore the property, and no error will be raised).
In the Global server settings section of the scanner context, the sonar.global.exclusions
and sonar.global.test.exclusions
are forced global parameters (see Principles governing the use of file exclusion parameters).
Verifying the analysis scope properties read by the scanner
To know which properties the scanner processes during the analysis run:
- In analysis debug logs, search for the
Project configuration
section as illustrated below (The scanner logs out to the place it was invoked from). The section may show:Excluded sources
: exclusion patterns processed by the scanner to compute the source files to be analyzed.Included sources
: inclusion patterns processed by the scanner to compute the source files to be analyzed.Excluded tests
: exclusion patterns processed by the scanner to compute the test files to be analyzed.Included tests
: inclusion patterns processed by the scanner to compute the test files to be analyzed.

Related pages
- Excluding specific files from your project's code coverage analysis or duplication check
- Excluding files from your project analysis based on path-matching patterns
- Excluding files from your project analysis based on file extension
- Applying advanced exclusions to your project analysis
- Performing other analysis scope adjustments
- Setting the initial scope of your project
- Adjusting the analysis scope at the global level
Was this page helpful?