Scan results for only changed lines and not entire file

We have pull branch analysis being done.

Basically,what am observing is that scan results are being posted for entire file and not just the changes lines of code.

Is it possible that scan results can be restricted to only the changes lines of code instead of the entire file that changed? Because it is creating too much noise for developers.

Is there a specific flag that meds to be set on sonarqube server or scanner that posts results to gerrit only for changed lines of code and not the entire code in the file?


Could you provide details and/or screenshots of where you’re seeing results on the entire file?


Sure Attached is a screen shot that shows scan result was posted on a line that was not changed. in screen shot below there is a green line that was changed but a pale yellow on top is a suggestion from sonar which is noisy to users.


Thanks for the screenshot. What UI is that? I don’t recognize it, and I’m wondering - based on that ‘Read more’ link whether the problem originates in SonarQube, this other system, or some 3rd thing that ports data from one to the other. (Because a message we provided would have gone to the specific rule, not just dumped you at the list of rules like what your screenshot shows.)


so we have sonarToGerrit plugin installed on jenkins that is talking to sonarqube and then post the results sent by sonarqube to gerrit server. the screen shot is from gerrit code server which users see for ther MR after pull branch analysis is done. regarding the rule link, that is set by me and you can ignore for now. however, we want to avoid that message that is tagged on code that was not touched.


The question here is going to be where the plugin is getting its data. If it’s from a PR analysis, then we need to back up to the detection of new code in that analysis.

If it’s from a full branch analysis, then this is something you need to take up with the plugin maintainers.


i figured it out… it was plugin option that allowed flag to be set.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.