No C++ files were analyzed

  • ALM used: GitHub
  • CI system used: GitHub Actions
  • Scanner command used when applicable:
cmake .. -DCMAKE_BUILD_TYPE:STRING="Release"
build-wrapper-win-x86-64 --out-dir sonar-analysis cmake --build . --config Release
sonar-scanner -X -D sonar.login=$SONAR_TOKEN -D sonar.host.url=$SONAR_URL -D sonar.projectKey=${SONAR_PROJECT_KEY} -D sonar.organization=$SONAR_ORGANIZATION -D sonar.projectName=OmniliumKnox -D sonar.projectVersion=$BUILD_VERSION -D sonar.sourceEncoding=UTF-8 -D sonar.sources=. -D sonar.cfamily.build-wrapper-output=sonar-analysis -D sonar.cfamily.threads=1 -D  sonar.cfamily.cache.enabled=true -D sonar.cfamily.cache.path=sonar-cache
  • Languages of the repository: Mainly C++
  • Error observed:
13:00:25.240 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:
  * you are using the latest version of the build-wrapper and the CFamily analyzer
  * you are correctly invoking the scanner with correct configuration
  * your compiler is supported
  * you are wrapping your build correctly
  * you are wrapping a full/clean build
  * you are providing the path to the correct build-wrapper output directory
  * you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps

Hi @detpikachu ,

sonar.sources refers to the build directory which doesn’t contain any source.

You should modify to have something like (note the --out-dir sonar-analysis ../cmake and the cd ..):

cmake .. -DCMAKE_BUILD_TYPE:STRING="Release"
build-wrapper-win-x86-64 --out-dir sonar-analysis ../cmake --build . --config Release
cd ..
sonar-scanner -X -D sonar.login=$SONAR_TOKEN -D sonar.host.url=$SONAR_URL -D sonar.projectKey=${SONAR_PROJECT_KEY} -D sonar.organization=$SONAR_ORGANIZATION -D sonar.projectName=OmniliumKnox -D sonar.projectVersion=$BUILD_VERSION -D sonar.sourceEncoding=UTF-8 -D sonar.sources=. -D sonar.cfamily.build-wrapper-output=sonar-analysis -D sonar.cfamily.threads=1 -D  sonar.cfamily.cache.enabled=true -D sonar.cfamily.cache.path=sonar-cache
2 Likes

Hello @mpaladin ,

EDITED 15.02.2021 17:35 UTC

I misread the above line. I am now pointing the sonar-scanner to the correct place and everything is working.

Thank you!

1 Like

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