Make copy of the rule

I would love to be able to copy an existing rule, specifically the ones with the threshold. Then I can have a Critical rule if the threshold is 10, and Major - if the threshold is 5.

I looked around, and didn’t see anybody suggested it. If I missed it - I apologize!

Hi Virshu. Welcome to the SonarSource community forum!

Can you describe the use cases for your proposal? Like who would use this, how would it be used on the team managing pull requests and a repository, etc.

Thank you @Monty_Dickerson - good to be here. I have a large code base that I am looking; so I would like to mark items with Cognitive Complexity of 25+ as critical; and 15-25 as major - so developers can filter and concentrate on critical first.
In this scenario this enhancement wouldn’t be tied to pull request or repository in any way different from how it is working now.
Or maybe I misunderstood your question?

Hi Virshu. I can understand that the developer team wants to address the worst code smells first, to reduce some technical debt of the overall code.

Since copying or activating a rule twice (with different parameters) is not supported, an approach I recommend is to adjust the threshold for complexity when activating the complexity rule for your quality profile. Once developers have refactored the most complex methods, revisit this setting to lower the threshold to normal.

A benefit of this approach is that having just one threshold makes clear the action developers must take with new code under review.

Yep; that’s what we are doing now… and that’s exactly why I suggested this enhancement. Thank you.

You are welcome, Virshu. Our product team has been made aware of your feature request and your use cases for it.

Thank you for choosing SonarQube.