SonarQube new code violations on short lived branches

Using the developer edition of SonarQube 7.7 and having the new code period set to previous_version, periodically major rule violations slip through pull requests. The quality gate is set to maintainability of A on new code which should fail analysis on major violations. Drilling down in the rating and code, the lines of new code calculation is correct and highlighted in yellow which normally denotes the new code. Also the error is identified as part of that new code showing the major violation.

Is there a way to prevent these from slipping from the short lived branch into the long lived branch.

Hi,

This is true for Reliability (Bugs) and Security (Vulnerabilities), but not for Maintainability (Code Smells). The Maintainability Rating is about the estimated remediation time (Technical Debt) versus the size of the code base. So if you really want to restrict all issues, including Code Smells, by severity, then you’ll have to do exactly that: add conditions on Major Issues on New Code, Critical Issues on New Code, and Blocker Issues on New Code.

 
HTH,
Ann

Thank you for the quick response and obvious / easy solution.