The report show "The main branch has no lines of code" while scan C language by armcc keil compiler

scan command:
build-wrapper-win-x86-64.exe --out-dir bw-output C:\Keil_v5\UV4\UV4.exe -b Project.uvproj
sonar-scanner.bat -D"sonar.projectKey=" -D"sonar.sources=….." -D"sonar.cfamily.build-wrapper-output=bw-output" -D"sonar.host.url=https://sonarqube.honeywell.com" -D"sonar.login="
File:
build-wrapper.log (454.8 KB)
build-wrapper-dump.json (339.4 KB)

Could you help how to solve this problem? Thank you!

Hey there,

Along with the buidl wrapper log and dump, can you provide the scanner logs in DEBUG mode? sonar-scanner -X

Hey there.

You’re still missing the log output of the scanner itself. That starts with something like…

colinmueller@device-203 ~ % sonar-scanner -X
10:14:23.594 INFO  Scanner configuration file: /Users/colinmueller/Tools/sonar-scanner-6.1.0.4477-macosx-aarch64/conf/sonar-scanner.properties
10:14:23.597 INFO  Project root configuration file: NONE
10:14:23.608 INFO  SonarScanner CLI 6.1.0.4477
10:14:23.608 INFO  Java 17.0.11 Eclipse Adoptium (64-bit)

It looks like all the files that get indexed are not code files, but built objects.

16:26:45.889 INFO  Base dir: C:\01.WorkSpace\03.Cyber\JTOSDPREADERSEC\09 Static_Code_Analysis\Code\MCU_CODE\U8.2\Template\Keil_project

And the actual code files might be somewhere else:

16:27:00.961 WARN  File 'C:\01.WorkSpace\03.Cyber\JTOSDPREADERSEC\09 Static_Code_Analysis\Code\MCU_CODE\U8.2\Firmware\GD32F30x_usbd_library\device\Include\usb_ch9_std.h' is ignored. It is not located in project basedir 'C:\01.WorkSpace\03.Cyber\JTOSDPREADERSEC\09 Static_Code_Analysis\Code\MCU_CODE\U8.2\Template\Keil_project'.

I suggest reevaluating what directory you’re starting the sonar-scanner from, and reevaluating your -D"sonar.sources=../../" configuration (instead of backtracking through the directories, just remove this configuration and execute sonar-scanner from the directory your code sits)

I’ve also gone ahead and hidden the post where you shared the scanner logs. Please make sure you redact tokens (and consider the one in the logs you shared compromised).

Thank you for your support. I have resolve this problem.