Verifying analysis scope

It is important to verify your analysis scope, once you've set things up in SonarQube Cloud. This page explains how to understand the context and properties as read by the scanner.

This section explains how to verify the configured properties and the properties read by the scanner to compute the project's analysis scope. See Introduction to Setting analysis scope for more information.

Verifying the analysis scope properties configured for the project

This procedure lets you view the properties configured in the different possible locations on the CI/CD host and in SonarQube Cloud UI for a given analysis run.

To verify the configured analysis properties for a project:

  1. Run the project analysis.

  2. 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 error File <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 (main) and test file. In this case, you must correct your analysis scope.

  3. You can also verify all the project’s exclusion parameters. To do so, proceed as follows:

    1. Retrieve the project. See Retrieving projects for details.

    2. Go to Your Project > Administration > Background Tasks.

    3. In the list, locate the project run you want to verify and click the three-dot menu in the far right column.

    4. In the contextual menu, select Show SonarScanner Context. The scanner context is shown:

      • The Organization server settings section (supported only with the Enterprise plan) shows the analysis parameters set in the UI for the organization.

      • 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.

You can access the SonarScanner Context report from the Background tasks page. Here, you can find all of the properties you've defined for that SonarQube Cloud project.

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.

Your SonarQube Cloud project's source and test files can be examined in the INFO logs produced by the SonarScanner.

Last updated

Was this helpful?