How does Technical Debt being calculated

Dear Support,

I think this is a pretty straight forward question: how does the technical dept being calculated?


Hi @tcsabina

You will find your answers on our docs.
Here are listed few pages:
→ Technical debt : The estimated time required to fix all Maintainability Issues / code smells
Technical Debt ( sqale_index )
Effort to fix all Code Smells. The measure is stored in minutes in the database. An 8-hour day is assumed when values are shown in days.

Technical Debt on New Code ( new_technical_debt )
Effort to fix all Code Smells raised for the first time on New Code.

Technical Debt Ratio ( sqale_debt_ratio )
Ratio between the cost to develop the software and the cost to fix it. The Technical Debt Ratio formula is:
Remediation cost / Development cost
Which can be restated as:
Remediation cost / (Cost to develop 1 line of code * Number of lines of code)
The value of the cost to develop a line of code is 0.06 days.

Technical Debt Ratio on New Code ( new_sqale_debt_ratio )
Ratio between the cost to develop the code changed on New Code and the cost of the issues linked to it.

Enjoy the reading :slight_smile:

Hi Carine,

I was looking for a more explicit, math formula based reply ;).

To see the relation between issue severity (Blocker+Critical+Major+Minor+Info) and Technical Debt.
Or relation between issue type (Bug+Vulnerability+Code Smell) and Technical Debt.

I know that there is an admin setting (sonar.technicalDebt.developmentCost) that defines the time needed to solve 1 line of code.

But how is the Technical Debt exactly calculated, still seems to be a misery… Even after looking/reading the docs you have linked.

The reason I am looking for this, because there is an ongoing discussion in my team about “Shall we include the Technical Debt in the Quality Gate or not?”.

If the Technical Debt is a value that is purely based on the number of the issues, I say that we don’t need it in the Quality Gate. It is enough if you measure the issue count.
If the Technical Debt is not just purely based on the number of issues, I would like to see the formula it is using, to understand it. So we can make a conscious decision about adding it to the QG or not.