Limit new defects in quality gate - Maintainability rating A with 380 new code smells

I have been working moving to a higher quality gate level and the current change I’m making passes the quality gate but has 380 new code smells.

The code smell count appears in the maintainability box which has an A rating.
I was initially surprised that such a large number of new issues could result in an A rating.
but according to the metric-definitions the rating comes from a technical debt ratio of <5%.

Similar to this old issue - Edit Maintainability criteria

I don’t think it is possible to set a limit on the number of new code smells a quality gate.
This might be a nice feature to add.

380 certainly seems way to high to allow code to pass.
I am aiming for a target of 0 so the code doesn’t get worse.


Keep in mind that Code Smells are about maintainability. We’re not talking about 380 things that will make your code fail in production or that open the door to attackers. We’re talking about 380 things that may make you or your colleagues hesitate or stumble the next time the code is maintained. That’s why the rating is calculated differently.

But to your point, you absolutely can add a limit on the count of Code Smells in New Code to your Quality Gate:


And I urge you to use this with caution. (There’s a reason we’ve tuned this to something that seems lax to you. :slight_smile: )