Violations relating to code coverage gets assigned to the author of last write to the file

Hi I’m using Enterprise version 8.4.2 of SonarQube. I could see that the violations for code coverage related issues gets automatically assigned to the author who wrote recently to the file though he/she hasn’t written those lines of code for which sonar shows issues regarding coverage. Can this be rectified so as to assign violations only for the code that is written by the respective authors?

Hi,

I’ve moved this to the Suggest New Rules category because you’re requesting a change to how these rules work.

In case it helps, rule raised at file level are going to be “blamed” on the most recent commit because that makes the most sense in the most cases. If I have a file that’s right below the threshold for raising a coverage issue, and then I make a change and it crosses the threshold then the issue is assigned to me. I may only be responsible for 1 uncovered line in the file. There may be people who have transgressed far worse than I have. But it was my commit that pushed the file over the edge. And if I cover my line, it will fall back under the threshold.

I know that doesn’t address what you actually asked for, but maybe understanding the philosophy helps.

 
Ann

Hi,

I thought that the above ideology you mentioned would work. But just came across an instance where I add three lines to the file and all the three lines that I added are fully covered by tests, still I see that the issue is coming up in my name. Ideally it should fall back under the threshold if my extra three lines caused the issue right?

Chandana

Hi Chandana,

If all 3 of your lines are covered, I wouldn’t have expected a new issue to be raised at all. I’m guessing that just before analysis the rule threshold was changed(?) and you fell “victim” to that.

As I alluded above, it’s not a perfect heuristic.

 
Ann