diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-01 14:17:45 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-01 14:17:54 +0100 |
commit | bab46aebf920654af1adb2b9aabf7f9b86988660 (patch) | |
tree | 27e9c23a39df79ed22e3280b64928c7af7319830 /plugins | |
parent | 608e72b03e61aadfe1b58817b3be6ad337617e3c (diff) | |
download | sonarqube-bab46aebf920654af1adb2b9aabf7f9b86988660.tar.gz sonarqube-bab46aebf920654af1adb2b9aabf7f9b86988660.zip |
Move calculation of accessors from squid to sonar
Diffstat (limited to 'plugins')
2 files changed, 8 insertions, 4 deletions
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/CopyBasicMeasuresBridge.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/CopyBasicMeasuresBridge.java index a783141cc75..14cd8876c55 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/CopyBasicMeasuresBridge.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/CopyBasicMeasuresBridge.java @@ -57,7 +57,6 @@ public final class CopyBasicMeasuresBridge extends Bridge { copy(squidCode, sonarResource, Metric.LINES_OF_CODE, CoreMetrics.NCLOC); copy(squidCode, sonarResource, Metric.LINES, CoreMetrics.LINES); copy(squidCode, sonarResource, Metric.COMMENT_LINES_WITHOUT_HEADER, CoreMetrics.COMMENT_LINES); - copy(squidCode, sonarResource, Metric.ACCESSORS, CoreMetrics.ACCESSORS); copy(squidCode, sonarResource, Metric.PUBLIC_API, CoreMetrics.PUBLIC_API); copy(squidCode, sonarResource, Metric.COMPLEXITY, CoreMetrics.COMPLEXITY); copy(squidCode, sonarResource, Metric.STATEMENTS, CoreMetrics.STATEMENTS); diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/decorators/FunctionsDecorator.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/decorators/FunctionsDecorator.java index 3bd9e65f2e3..e8ec5e24d2b 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/decorators/FunctionsDecorator.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/decorators/FunctionsDecorator.java @@ -33,13 +33,18 @@ public final class FunctionsDecorator implements Decorator { public void decorate(Resource resource, DecoratorContext context) { if (Scopes.isType(resource)) { - int methods=0; + int methods=0, accessors=0; for (DecoratorContext child : context.getChildren()) { - if (child.getResource() instanceof JavaMethod && !((JavaMethod)child.getResource()).isAccessor()) { - methods++; + if (child.getResource() instanceof JavaMethod) { + if (((JavaMethod)child.getResource()).isAccessor()) { + accessors++; + } else { + methods++; + } } } context.saveMeasure(new Measure(CoreMetrics.FUNCTIONS, (double)methods)); + context.saveMeasure(new Measure(CoreMetrics.ACCESSORS, (double)accessors)); } } |