Coverage data ignored

SonarQube server 8.9.6
SonarScanner 4.6.2.2472
Windows 10
Cfamily

Hi, does anyone know why sonar-scanner.bat is ignoring 322 files? When I check moc_LocalContent.cpp and FileChannel.h it mentions in the output, those files exist in the workspace.

10:22:45  10:22:45.228 INFO: Sensor Generic Coverage Report
10:22:45  10:22:45.228 INFO: Parsing C:\jenkins\workspace\dev\sonar-analysis\build\juno-desktop-coverage.xml
10:22:45  10:22:45.495 INFO: Imported coverage data for 362 files
10:22:45  10:22:45.495 INFO: Coverage data ignored for 322 unknown files, including:
10:22:45  C:\jenkins\workspace\dev\sonar-analysis\build\legacy\pc64-vc-tool-debug\__Generated__\runtime\legacy\include\legacy\engine\content\moc_LocalContent.cpp
10:22:45  C:\jenkins\workspace\dev\sonar-analysis\legacy\source\services\downloader\io\FileChannel.h
10:22:45  C:\jenkins\workspace\dev\sonar-analysis\build\legacy\pc64-vc-tool-debug\__Generated__\runtime\legacy\include\legacy\services\downloader\moc_CRCMap.cpp
10:22:45  C:\jenkins\workspace\dev\sonar-analysis\build\core_qt\predefined c++ types (compiler internal)
10:22:45  C:\jenkins\workspace\dev\sonar-analysis\legacy\source\services\publishing\NucleusEntitlement.cpp
10:22:45  10:22:45.495 INFO: Parsing C:\jenkins\workspace\dev\sonar-analysis\build\ui-coverage.xml
10:22:45  10:22:45.519 INFO: Imported coverage data for 47 files
10:22:45  10:22:45.519 INFO: Sensor Generic Coverage Report (done) | time=291ms

Hello @jhavero,

Could you please provide us the command line you use to run the scanner, the full log of the scanner (in debug mode) and your sonar-scanner.properties file?

Thank you!

Hi Loic, can I send you that info to your DM?

Hello @jhavero,

Apparently, the files that are ignored are in folders such as:

C:\Users\originautomation\fix-sonar\juno-desktop\build
C:\Users\originautomation\fix-sonar\juno-desktop\legacy

However, when we look at the files that are indexed at the start by the scanner, they all look to be in folders like:

C:\Users\originautomation\fix-sonar\juno-desktop\apps
C:\Users\originautomation\fix-sonar\juno-desktop\plugins
C:\Users\originautomation\fix-sonar\juno-desktop\components
C:\Users\originautomation\fix-sonar\juno-desktop\domain
C:\Users\originautomation\fix-sonar\juno-desktop\services
C:\Users\originautomation\fix-sonar\juno-desktop\foundation

Which are the folders defined in the property: sonar.sources.

The ignored files seem to be files generated during the build and external code, and such files are usually ignored on purpose during the analysis, but if you want to take them into account, you should just add the folder they are in to sonar.sources.

Thanks that helped but there are still 97 files ignored now after including build and legacy in the sonar source. I uploaded the new log to your DM.

Once again, those files are not indexed, the goal is now to understand why (and once again, since they are generated files, I’m not sure of the value of including them in your analysis…).

First, could you check for instance that the file C:\Users\originautomation\fix-sonar\juno-desktop\build\legacy\pc64-vc-tool-debug\__Generated__\runtime\legacy\include\legacy\engine\content\moc_BaseGamesController.cpp exists on the disk when you run the scanner (since it is a generated file, maybe it existed at some point when the coverage info was generated, and it was removed later in the process).

Secondly, it appears that the SCM ignore file already ignores many generated files:

16:18:00.785 DEBUG: File 'C:\Users\originautomation\fix-sonar\juno-desktop\build\core\__Generated__\include\core\version.h' is excluded by the scm ignore settings.

Could you check what your .gitignore file contains (by default, we don’t analyze files that are not part of source control)?
If you want to change this behavior, you can set the property sonar.scm.exclusions.disabled to true.

Alright I got it.
I mis-read I thought there was still legacy source but those remaining files are all under build which we don’t need to report on.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.