I ran a Merge Request on a C++ project, with about 30 modified files. As this project is pretty old, there were many issues which were accepted on these files, and during these MR, only 1 or 2 new issues were raised (new code) per file.
But for one of the file, all issues were “awaken”, not only on the modified lines, and I don’t understand why. I checked encoding and new lines type, and I didn’t see anything weird. I also did a git diff.
I had a look in the Sonar log files, and I didn’t find any mention of this file.
I ran Sonar again on the target branch, with the last wrapper (6.77), because the last analysis had been done with 6.76, then ran again the branch analysis, but I got the same result.
The problem came back for an other PR. The problems are mainly related to dynamic memory (92 issues on 105): cpp:S984 & cpp:S9025. It is because of new/delete instructions for Qt widgets.
Half of these issues were coded 5 years ago.
No, I can’t. Our Jenkins workspace is overwritten at each build, and some builds were run since my last comment. I will join the log at the next occurrence.
Do you mean wrapper log, or scanner log ?
The target branch (generally develop branch, which is also the “main banch”) is analyzed frequently, and I rerun analysis on the target branch as soon as I get troubles with a MR. But…
We also frequenty do git rebase operations, as soon as there was a merge on the target branch. So the source branch may have overcome one or several rebase since its creation. Also, what about the Sonar cache when different MR analysis (for different source branches) are interlaced ?
MR1: S1 → T → Sonar issues (so, no merge yet) → related develop is fixing the issues…
MR2: S3 → T → Sonar issues (so, no merge yet) → related develop is fixing the issues…
MR1: S1 → T → …
Have you configured sonar.cfamily.analysisCache.mode to a non-default value? By default, the cache is held server-side, per branch & so shouldn’t be impacted by the analysis order of various branches.
What blame dates show up for the lines of ‘awakened’ issues? What issue dates?
Where is the analysis cache ? What’s its name ? Is it build-wrapper-dump.json ?
By the way, my browser (Firefox) doesn’t succeed to interpret is as a JSON file (no problem with compile_commands.json).