Issue reopened as new after changing/reverting rule config

new_code

(RexWu) #1

I changed “Threshold” of the “Cognitive Complexity of methods should not be too high” rule(Java) -> scan my project -> revert the “Threshold” -> scan my project again, SonarQube displayed some “New Code Smells”, but I didn’t update any code, is it a bug?


(Nicolas Bontoux) #2

Hi,

Nope, not necessarily. Because when you’ve analysed after changing the threshold, you might effectively have closed a bunch of related issues. When reverting the threshold those same issues get detected, but this time as new, since they were just closed beforehand.

Note that there are planned improvements in SonarQube to more gracefully handle transient/unintended closure of issues: Preserve issue tracking on closed issues. Should be coming in SonarQube v7.4.


(RexWu) #3

The “Leak Period” setting is “BASELINE”, why SonarQube didn’t compare to “BASELINE” but “previous”?


(G Ann Campbell) #4

Hi,

Issues are backdated in some situations, but not the one you describe. In practical terms, that means that when an analysis finds an issue that does not already exist, it creates a “new” issue. I.e. an issue dated with the timestamp of the analysis and that new issue ends up in the leak period.

So what you did was

Closed some old issues

Opened brand new issues.

Note that from 7.4 (E.T.A. end of the month) we’ll reopen those closed issues instead of creating new ones.

Ann