Could you please split rule Cognitive Complexity into several levels of severity?


I find this rule a bit unfair because it raises 1 critical warning for each method scoring strictly above 15.
I realized that the refactoring of methods scoring 200+ can result into lots of methods scoring like 16 or 17. I think that threshold effect is unfair, but there’s worse, because after this refactoring, the situation actually improved, but it resulted in introducing dozens of new critical cognitive complexity warnings.

I recommend setting new rules that will help better measure how the situation is actually improving.

  • 15-16 : Info level
  • 17-25 : Minor level
  • 26-50 : Major level
  • 51+ : Critical level
    We may disagree on the ranges but agree on the idea.

Thanks & regards,
Nicolas Baumann.

Hi Nicolas,

Thanks for bringing this up. Indeed, it feels strange that fixing one issue creates more issues than before :slightly_smiling_face:

In what programming language(s) are you seeing these?

Could you share some simplified examples?



I’m using JAVA, but it can apply to other languages.

I’m sorry I haven’t anything to share at the moment, but there are plenty of open source projects and this is where I would look into.