0 code was shown after running sonar-scanner

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube version: Data Center Edition Version 8.9.6 (build 50800)
    Sonar Scanner version: sonar-scanner-cli-

  • what are you trying to achieve
    We are trying to perform sonarqube scan for source code with build-wrapper-win-x86

  • what have you tried so far to achieve this
    In project folder, build wrapper can be run successfully:
    build-wrapper-win-x86-64.exe --out-dir bw-output make clean

sonar-scanner.bat can be run successfully:
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------

But When I go to dashbodard of sonarqube, no issues found;
go to the menu “code”, no folder/C source code found except 2 folders in project. it seems it did not scan C source code.

Please kindly help to look into it.

Thank you


Welcome to the community!

Can you share your analysis log? It’s what’s output from the analysis command. Hopefully, the log you provide will include that command as well.


Hi Ann,

Thanks for your support.
please find the logs attached.

log_of_ build-wrapper.txt (316.7 KB)
log_of_sonarscan.txt (7.3 KB)

From above, the files in project folder were analyzed, but source code in red rectange not analyzed.

Hey there

It seems pretty logical that only the EverestMMI.X folder is being analyzed.

INFO: Base dir: C:\microchip\harmony\v2_06\apps\AdvHMI\firmware\EverestMMI.X

To start analyzing anything outside of this folder, you’d need to make sure you start the scan from the directory you want recursively analyzed (starting sonar-scanner from the firmware folder, for example).

This is also assuming that everything inside the firmware folder is being build (and wrapped by the build wrapper). You won’t be able to analyze C/C++ code outside of the EverestMMI.X folder unless it’s also being built.

Hi Colin,
Great thanks for your quick response.

When I ran sonar scan in the firmware folder including source code:
(build wrapper was run under folder C:\microchip\harmony\v2_06\apps\AdvHMI\firmware\EverestMMI.X)
sonar scan fails, please kindly help to look into it:
attached the log of sonar scan and bw-output files.
scan.txt (18.9 KB)
build-wrapper-dump.json (518 Bytes)
build-wrapper.log (1.1 KB)

It seems like the build wrapper is producing different results than last time. Are you sure your build command is working?

Wed Jun 22 19:28:36 2022: process with pid 15096 exit with code: 2 (0x2)

I tried to run build wrapper in folder C:\microchip\harmony\v2_06\apps\AdvHMI\firmware and failed, it maybe the root cause.
I’ll try to re-run build wrapper in folder C:\microchip\harmony\v2_06\apps\AdvHMI\firmware\EverestMMI.X

and get back to you later. Thank you

Hi Colin,
I re-ran the build wrapper and sonar scan, it fails. Attache complete log for your check.
thank you.
scan.txt (347.2 KB)
build-wrapper-dump.json (4.0 MB)

Hey there.

It looks like you’ve ran the build wrapper from the EverestMMI.X directory (and specified that the output should go into the bw-output folder in the EverestMMI.X directory), but then you’ve gone back one directory, ran the sonar-scanner, and specified sonar.cfamily.build-wrapper-output=bw-output even though the actual output is back in the EverestMMI.X directory.

You probably want to try something like this:

sonar-scanner.bat -D"sonar.projectKey=ADVHMI" -D"sonar.sources=." -D"sonar.cfamily.build-wrapper-output=EverestMMI.X/bw-output" -D"sonar.host.url=https://sonarqube.(removed).com" -D"sonar.login=(removed)"

Hi Colin,

I ran sonarscan successfully and got the complete scan report as per your suggestion.
Thank you, Much appreciated!

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