Calculation of the Debt
Debt(in man days)
cost_to_fix_one_block * duplicated_blocks
cost_to fix_one_violation * (violations - info_violations)
cost_to_comment_one_API * public_undocumented_api
cost_to_cover_one_of_complexity * uncovered_complexity_by_tests
cost_to_split_a_method * (function_complexity_distribution >= 8) +
cost_to_cut_an_edge_between_two_files * package_edges_weight
All costs can be configured by going to Configuration -> Settings -> Technical Debt.
Default values for costs are :
Cost (in hour)
This gives a debt in hour from which can be deducted the debt in man days and then in $$ by using values that can be configured :
Hours per day
Price of a dev day
Calculation of Debt ratio
The debt ratio is basically the debt divided by the Total Possible Debt (TPD) times 100.
The first thing we should calculate is the TPD on every axis :
Given the number of blocks of duplication and the current %of lines duplicated, calculate the number of blocks there would be if it was 100%. If duplication is currently 0% then maximum number of blocks is calculated on the basis of 50 Lines per block. Total possible debt is the cost to fix those blocks.
Given the current RCI and the current number of violations, how many violations would be required to bring the RCI to zero. If RCI is 100%, the number of violations used is NLOC/3. Total possible debt is the cost to fix those blocks.
Total possible debt is the cost to bring coverage from 0% to 80%.
Total possible debt is the cost to split every method and every class.
Total possible debt is the cost to comment every public API
Given the existing edges between files, the cost of having to cut all of them (package tangle index = 100%)
TPD = sum TPD on each axis