I am a developer using SonarQube, and I have recently encountered some questions regarding the maintainability rating standards within your product. I am hoping to receive assistance and answers through this post.
In our SonarQube instance, I noticed that the maintainability rating for a particular project is displayed as “A,” which should mean that the technical debt ratio is less than 5.0%. However, according to my calculations (technical debt of 10 days related to 1,000 lines of code), the technical debt ratio is approximately 16.67%, which is much higher than the threshold for an “A” rating.
I am unsure if the configuration in our instance is different, or if I have missed some critical factors during my calculations. To ensure our project assessments are accurate and consistent with SonarQube standards, I would like to know:
Has the default maintainability rating standard in SonarQube changed, and if so, what is the current standard?
If our instance is using a custom rating configuration, where can these configurations be viewed and modified?
Are there recommended steps to verify that our settings and calculations are correct?
We greatly value the role of your product in enhancing our code quality and hope to clarify this confusion as soon as possible. Thank you for your support and assistance!
As a first step, could you tell us what version and edition of SonarQube you’re using?
The technical debt calculations can be changed under the global Administration > Technical Debt. Can you check to see if the default values are being used?
And finally, if everything is the default, it would be great for you to share more information (screenshots from the product is best) showing how you’ve arrived at the calculation fo 16.67%.
Given data
• Technical debt: 10 days
Number of code smells: 1,000 lines of code
Calculation steps
Convert technical debt to days:
• 10 days of technical debt has been given.
Calculate development costs:
• Based on the previous assumption, each line of code costs 0.06 days to develop (this is SonarQube’s default estimate in 8 hours per person day).
• Development cost = 0.06 days/line × 1,000 lines = 60 days
Calculate technical debt ratio:
• Technical debt ratio = 10 days / 60 days = 0.1667
Determining ratings
According to SonarQube’s default maintainability rating grid:
• A is equal to 0 minus 0.05
• B = 0.06-0.1
• C = 0.11-0.20
• D = 0.21-0.5
• E = 0.51-1
Since the calculated technical debt ratio is 0.1667, this falls within the range of a rating of C. But now it says A.
Do me a favor and grab some screenshots from the SonarQube UI, specifically under the Measures tab. I’d like to see the Maintainability and Size sections.