Skip to content
Latchkey

How to Gate on the Technical Debt Ratio

The technical debt ratio is remediation cost divided by development cost; a gate condition caps it on new code.

Sonar derives the maintainability rating from the debt ratio. Add a condition on "Technical debt ratio on new code" (SQALE), or equivalently require rating A, so debt-heavy diffs fail.

How the rating maps

Debt ratioMaintainability rating
0 to 5%A
6 to 10%B
11 to 20%C
over 50%E

sonar-project.properties

sonar-project.properties
sonar.projectKey=my-org_my-repo
sonar.sources=src
# Gate condition (new code): Technical Debt Ratio > 5.0 fails
sonar.qualitygate.wait=true

Gotchas

  • Debt time estimates come from rule remediation costs; custom rules need a remediation function set.
  • The ratio is relative to lines changed, so a tiny risky diff can spike it more than a large clean one.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →