Differences on new code measures and overall code measures between analysis of the same code base using incredibuild

Version:

  • SonarQube server 9.0.0.45539 Enterprise edition
  • Build Wrapper for Windows from {SonarQube URL}/static/cpp/build-wrapper-win-x86.zip
  • SonarScanner 4.6.2.2472
  • Incredibuild V. 9.2.2

What are you trying to achieve:

I am trying to analyse part of big mono repository as SonarQube project. Part of the code base is huge enough to contain over 1 million of lines and mostly C/C++ is being used. After first successful analysis I have problem that every time I run analysis over same code base different amount of code smells and bugs are reported for both new code and overall code. When we compile this code we are using incredibuild which distributes the compile to different servers.
Does any one have experiences with this

Analysis warnings:

  • There are problems with file encoding in the source code. Please check the scanner logs for more details.
  • Missing blame information for 8 files. This may lead to some features not working correctly. Please check the analysis logs and refer to the documentation.

Tried so far:

  • SonarQube project recreation
  • making small change in code base between the builds to ensure new commit hash (like adding a single comment)
  • sonar.projectVersion property value’s incrementation between the builds
  • analysing different part of mono repository

Did anyone face something similar? Should new code’s options be somehow adjusted? Any help will be really appreciated.

I’m having a similar problem but it’s the code displayed when looking at code smells that’s not updating. I’ve filed a ticket that’s currently hidden due to the spam filter for new users.

Hello @brianvigh,

Welcome to the community!

Build-wrapper detects the commands that compile your files, writes them in the .json file, and the scanner runs the analysis on files with entries in the build-wrapper .json file. That means:

  • You should make sure that the command provided to build-wrapper is running full clean build
  • The build and analysis should happen on the same host which is not the case with your configuration. This explains the inconsistency.

So you either have to make sure that you are building and analyzing on the same server. Or you can use a compilation database as build-wrapper alternative: you have to make sure that you are running the generation and analysis on one server that contains your build toolchains.

Have a look at this blog post and the documentation:

If you still face issues after this please share the logs that you are referring to.
Thanks,