diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-10-11 14:03:21 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-10-11 14:38:08 +0200 |
commit | e16c5a4cb63d3358a4a34442a3ac9b64896881cb (patch) | |
tree | a7313c4ec9143be096ea7bda5f3b1e1b57c9efd3 /plugins | |
parent | 401abbe560aa06d5e3a4668f14cd0c646eea40af (diff) | |
download | sonarqube-e16c5a4cb63d3358a4a34442a3ac9b64896881cb.tar.gz sonarqube-e16c5a4cb63d3358a4a34442a3ac9b64896881cb.zip |
Revert "SONAR-4753 Modify the technical debt density calculation"
This reverts commit fed100c4c662cc78b857d12b1e0968b1e664de6b.
Diffstat (limited to 'plugins')
3 files changed, 6 insertions, 4 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/technicaldebt/TechnicalDebtDensityDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/technicaldebt/TechnicalDebtDensityDecorator.java index 45de47d013b..1a7926a1fcb 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/technicaldebt/TechnicalDebtDensityDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/technicaldebt/TechnicalDebtDensityDecorator.java @@ -36,6 +36,8 @@ import static com.google.common.collect.Lists.newArrayList; @DependsUpon(DecoratorBarriers.ISSUES_TRACKED) public final class TechnicalDebtDensityDecorator implements Decorator { + private static final int DECIMALS_PRECISION = 5; + public boolean shouldExecuteOnProject(Project project) { return true; } @@ -59,8 +61,8 @@ public final class TechnicalDebtDensityDecorator implements Decorator { Measure ncloc = context.getMeasure(CoreMetrics.NCLOC); if (technicalDebt != null && ncloc != null && ncloc.getValue() > 0d) { - double value = technicalDebt.getValue() / ncloc.getValue() * 1000; - context.saveMeasure(new Measure(CoreMetrics.TECHNICAL_DEBT_DENSITY, value)); + double value = technicalDebt.getValue() / ncloc.getValue(); + context.saveMeasure(new Measure(CoreMetrics.TECHNICAL_DEBT_DENSITY, value, DECIMALS_PRECISION)); } } diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index b323f3569b5..a11dda4a588 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -2289,7 +2289,7 @@ metric.confirmed_issues.description=Confirmed issues metric.sqale_index.name=Technical Debt metric.sqale_index.description=The technical debt is the total effort required to fully adhere all quality requirements defined by a user. metric.technical_debt_density.name=Technical Debt Density -metric.technical_debt_density.description=The density of technical debt is the average remediation cost for 1000 non commenting lines of code. +metric.technical_debt_density.description=Density of technical debt based on the number of non commenting lines of code. diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/technicaldebt/TechnicalDebtDensityDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/technicaldebt/TechnicalDebtDensityDecoratorTest.java index 2e9174f9c6d..155bdd2ecc1 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/technicaldebt/TechnicalDebtDensityDecoratorTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/technicaldebt/TechnicalDebtDensityDecoratorTest.java @@ -102,7 +102,7 @@ public class TechnicalDebtDensityDecoratorTest { decorator.decorate(resource, context); - verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.TECHNICAL_DEBT_DENSITY, 31.3d))); + verify(context).saveMeasure(argThat(new IsMeasure(CoreMetrics.TECHNICAL_DEBT_DENSITY, 0.03125d))); } } |