New-code without blame

Hello,

Our project uses git as configuration management and contains non-quality issues that are related to documentation (traceability links, broken links in documentations etc…). We would like to display theses information within the “new code” tab to easily identify the “debt” a branch contains relatively to the main branch.

Theses non-quality issues are computed by our internal documentation tool and various python scripts so I’ve tried to create Generic formatted issue reports and even though the newly introduced issues are correctly displayed in the overall tab, when I comes to new code I’m struggling a bit. Due to the nature of the issues I can’t fill the “primaryLocation” section with precision (sometime I can’t tell from which file the issue is coming) and therefore the issue is not displayed in the “new code” tab because the “primaryLocation” hasn’t been modified if the feature branch.

For example:

In my feature branch I want to create a new traceability link between Req1 and Req25 but unfortunately I misspelled the name of Req25 into Rqe25 => my internal tool will indicate a traceability issue but can’t tell in which file the issue is located (traceability file itself? wrong configuration management of Rqe25?) Globally I don’t really care of the exact location, I just want the “new code” tab on my feature branch to show me that I have introduced a traceability issue on whichever file.

Therefore I have two questions:

  1. Is this behavior achievable with built-in sonar functionalities ?
  2. If its not, I think I am able to develop a custom plugin but is this even possible with such a development ?

I hope I was clear enough, thank you for you answers.

Hi,

Welcome to the community!

I think you’ve identified the crux of the issue:

As I see it, your best option is to cheat and have some file/line in that you modify in each branch/PR, and attach all the issues there.

The alternative is, yes, to write a plugin and deep-dive into the first round of SCM analysis the scanner does so that the language analyzers know what to scan and what to ignore in a PR, and attach your issues based on that.

 
HTH,
Ann

Hello, thank you for your answer and your input regarding the plugins. Maybe you are aware of an existing plugin that I can look into that deals with this stuff?

Thanks

Hi,

As I mentioned the language analyzers use this data in the context of PR analysis, and several of them are open source.

The Kotlin analyzer is one of the newer kids on the block, so it would presumably have less accumulation to wade through to get to what you’re after, but I haven’t done any code-diving myself here, so that’s mainly a guess.

 
HTH,
Ann

1 Like