Only collect code coverage (not code quality checks)?

Must-share information:

which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)?

SonarQube Enterprise Edition Version 7.7 (build 23042)
SonarQube Scanner 4.0.0.1744

what are you trying to achieve

For a C++ project, is it possible to only collect code coverage and not running the code quality checks? I am working with a very large project and I suspect having a large number of rules is seriously slowing down our sonar-scanner, and I don’t require the code quality checks to run every single time.

Hi @SakeebHossain,

it is not possible to import coverage separately from the analysis for the same project in two different runs as it would override the previous analysis. Why would you say the you don’t require code quality checks to run every single time?

FYI, we are working to have have incremental analysis to not have to scan the full project each time.

Why would you say the you don’t require code quality checks to run every single time?

Ideally we would like to, however each time the sonar-scanner runs it takes upwards of 3 hours (project contains 1.5 M lines of C/C++ code). This is just too long for us to run on-PR as a part of CI. As of now I am mostly concerned at with just getting the coverage results and using that as a quality gate.

As I mentioned, it seems like the quality checks are what is slowing the scanner down. Is there some way to have the scanner only check “changed” code instead of doing a full analysis every time?

Hi @SakeebHossain,

regarding

note that we are working to speed-up the analysis exactly for this purpose.

Out of curiosity, are you setting sonar.cfamily.threads property to use multi-threaded analysis?

Yes, I’m using sonar.cfamily.thread=4 on an 8 core machine.

it is not possible to import coverage separately from the analysis for the same project in two different runs as it would override the previous analysis.

Is there maybe a way I can force my project to run against an empty quality profile? I tired creating Quality Profiles with no active rules and set my project to use them, however the scanner still takes a long time to run. Am I doing something wrong or is this just not possible?

Hi @SakeebHossain,

empty quality profiles disable the checkers, however the core frontend is still executed still taking some time.

If you have no other things in parallel you can set 8 threads on 8 core machines. If you have hyper-threading you can even set it to 8x2=16 threads.

Hi @mpaladin, I’ve been messing around and suddenly my scanner run times are much faster (~2 minutes). It appears I managed to disable the C/C++ static analysis since the front-end now shows zero detected bugs, but coverage results are still reported. Basically this is exactly what I wanted, but I’m not sure exactly what I changed! I ran the scanner in debug mode and included the log, can you help me find out what I did differently?

log.txt (1.9 MB)

Hi @SakeebHossain,

no files are analyzed here, see the line ‘0 compilation units analyzed’, the build-wrapper-dump.json files is likely to be empty.

FYI you are using 18:02:16.295 DEBUG: * SonarCFamily 6.2.0.11201 (cpp), the latest version is 6.4.

@mpaladin build-wrapper.log and build-wrapper-dump.json are not empty, see attached:

build-wrapper-dump.txt (109.8 KB)
build-wrapper-log.txt.txt (243.5 KB)

Hi @SakeebHossain,

could you please make sure you are using latest version please?

There is only 1 entry in the json: tm1server/prod/tm1s/tm1s_dummy.cpp which is probably not mapped to any file belonging to the project and part of the analysis.