Sonar scan report is empty, build-wrapper json more than 20mb and ignored

hi, we are using developer edition

  • Developer Edition
  • Version 9.9.1 (build 69595)

build-wrapper-dump.json' is bigger than 20MB and ignored.

while running the scanner:

WARN: File '/home/klocwork/sonar-cucp/5g_cucp/5gran/cu/gnb_mgr_ms/build_gnb_mgr/bw-output/build-wrapper-dump.json' is bigger than 20MB and as consequence is removed from the analysis scope.
WARN: File '/home/klocwork/sonar-cucp/5g_cucp/5gran/cu/gnb_mgr_ms/build_gnb_mgr/bw-output/build-wrapper.log' is bigger than 20MB and as consequence is removed from the analysis scope.
WARN: File '/home/klocwork/sonar-cucp/5g_cucp/5gran/cu/gnb_mgr_ms/build_gnb_mgr/gnb_cu_cp_gnb_mgr' is bigger than 20MB and as consequence is removed from the analysis scope.
INFO: 4 files indexed
INFO: 0 files ignored because of scm ignore settings


INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarqube.intinfra.com/dashboard?id=5gran-build_gnb_mgr-5.0-centos
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarqube.intinfra.com/api/ce/task?id=AZH_JwC_EsRT7FGtPBNs
INFO: Analysis total time: 16.406 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 20.055s
INFO: Final Memory: 30M/148M
INFO: ------------------------------------------------------------------------
^C
[1]+  Done                    nohup /dept/buildtools/sonar-scanner/bin/sonar-scanner -Dsonar.projectKey=5gran-build_gnb_mgr-5.0-centos -Dsonar.sources=. -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.host.url=http://sonarqube.intinfra.com:9000 -Dsonar.login=sqp_10e7a2b235d53ae43e9a33c9f860132d5de797de

sonar scan Report is empty.

version:

[klocwork@ran5g-kw-c79 bw-output]$ /opt/build-wrapper-linux-x86/build-wrapper-linux-x86-64
build-wrapper, version 6.41 (linux-x86)
Copyright (C) 2014-2022 SonarSource SA, info@sonarsource.com

Usage: /opt/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir <output directory> <build command>
[klocwork@ran5g-kw-c79 bw-output]$ /dept/buildtools/sonar-scanner/bin/sonar-scanner --version
INFO: Scanner configuration file: /dept/buildtools/sonar-scanner-4.6.2.2472-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
INFO: Linux 3.10.0-1160.62.1.el7_9.emrs.1.x86_64 amd64
[klocwork@ran5g-kw-c79 bw-output]$

Does it mean the code doesn’t have any bug, or since the size is huge it ignored.
how to fix this.

Hi,

Welcome to the community!

It sounds more like this. Can you share how big your project is? And how did you create the build-wrapper-dump.json file?

 
Thx,
Ann

WARN: File ‘/home/build/sonar-cucp/5g_cucp/5gran/cu/iwf/sctp/src/sctp_xn_client.cpp’ is ignored. It is not located in project basedir ‘/home/build/sonar-cucp/5g_cucp/5gran/cu/iwf/build_e1ap_iwf’.
WARN: File ‘/home/build/sonar-cucp/5g_cucp/5gran/cu/iwf/sctp/src/README.txt’ is ignored. It is not located in project basedir ‘/home/build/sonar-cucp/5g_cucp/5gran/cu/iwf/build_e1ap_iwf’.
WARN: File ‘/home/build/sonar-cucp/5g_cucp/5gran/cu/iwf/sctp/src/sctp_cntrl.cpp’ is ignored. It is not located in project basedir ‘/home/build/sonar-cucp/5g_cucp/5gran/cu/iwf/build_e1ap_iwf’.
WARN: File ‘/home/build/sonar-cucp/5g_cucp/5gran/cu/iwf/sctp/src/sctp_cntrl_db.cpp’ is ignored. It is not located in project basedir ‘/home/build/sonar-cucp/5g_cucp/5gran/cu/iwf/build_e1ap_iwf’.

we have tried other small project where the .json file is less than 20MB, but again since the cpp files are not present in the same place as make file present, scan report is empty

Hi,

I’m still looking for an understanding of how big your project is and how you created your build-wrapper-dump.json file. (I assume it was by … wrapping the build, but I’ve learned it doesn’t pay to assume.)

 
Ann

/home/klocwork/sonar-cucp/5g_cucp/5gran/cu
[klocwork@ran5g-kw-c79 cu]$ du -sh gnb_mgr_ms
2.0G gnb_mgr_ms
[klocwork@ran5g-kw-c79 cu]$ du -sh gnb_mgr_ms/build_gnb_mgr
482M gnb_mgr_ms/build_gnb_mgr
[klocwork@ran5g-kw-c79 cu]$

[klocwork@ran5g-kw-c79 build_gnb_mgr]$ du -sh bw-output/
57M bw-output/
[klocwork@ran5g-kw-c79 build_gnb_mgr]$ cd bw-output/
[klocwork@ran5g-kw-c79 bw-output]$ du -sh *
23M build-wrapper-dump.json
35M build-wrapper.log
[klocwork@ran5g-kw-c79 bw-output]$

build-wrapper step:
nohup /opt/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make -j6 &

sonar scan step:
nohup /dept/buildtools/sonar-scanner/bin/sonar-scanner
-Dsonar.projectKey=5gran-build_gnb_mgr-5.0-centos
-Dsonar.sources=.
-Dsonar.cfamily.build-wrapper-output=bw-output
-Dsonar.host.url=http://sonarqube.intinfra.com:9000
-Dsonar.login=sqp_xxxx &

Hi,

You’ve just published your server URL & plain-text analysis token. I’ve redacted the latter, but you’ll still want to revoke it and re-issue.

Meanwhile, I’m going to flag this for the language experts.

 
Ann

Hello @kandasamy and welcome to the community,

This warning comes from the scanner indexing the files. It indicates that the build-wrapper-dump.json file itself isn’t going to be analyzed; It doesn’t mean that the -Dsonar.cfamily.build-wrapper-output property you provided to the scanner was ignored.

Could you provide more details about how those files are not being in the same place? Note that for a file to be analyzed, it should be located under the directory specified by -Dsonar.sources=., and it has to be compiled by your wrapped build command.

Also note that the scanner should be invoked on the same machine where the wrapped build command was executed. See the docs here.

To help us understand the problem, could you share the following files with us?

  1. Files from your bw-output directory (build-wrapper-dump.json and build-wrapper.log)
  2. Your verbose scanner logs. You can enable verbose logs by adding the property -Dsonar.verbose=true, see the docs here.

I can also open a private thread with you if you prefer to share this information privately,

Best regards,
Michael

Yes, you can create private thread, i will share more information on that.

thanks
Kanda.

This issue turned out to be that sonar.sources is set to a directory outside the project base dir (the scanner was invoked from the build directory).

1 Like