Search code examples
javasonarqubetechnical-debt

Sonarqube - Getting Incorrect Technical Debt Measure in Plugin


I am developing a plugin in Java for SonarQube (version 4.3.2) and need to make use of TECHNICAL_DEBT metrics present in CoreMetrics. I wrote below code to get this metrics from my Decorator.

    Metric metric = metricFinder.findByKey(CoreMetrics.TECHNICAL_DEBT_KEY);
    data = context.getMeasure(metric);.getIntValue();
    LOGGER.debug("{}: {}", CoreMetrics.TECHNICAL_DEBT_KEY, data);

Everything works fine so far, But the output of this code is different from the Technical Debt displayed on the Sonar dashboard.

Output of this code: sqale_index: 15750

Dashboard displays: Technical Debt 32d

Am I missing something in my understanding or programming? Please help.


Solution

  • The measure of the technical debt is stored in minutes in the DB. Which is consistent with what you see: 15750 (minutes) / 60 (minutes per hour) / 8 (working hours per day) = 32.8 days