From: simonbrandhof Date: Wed, 20 Apr 2011 13:25:30 +0000 (+0200) Subject: SONAR-2255 the metric 'classes' must not be 0 on unit tests X-Git-Tag: 2.8~161 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0766d9835cb65e88c5335dd686f8f37d803cf1f9;p=sonarqube.git SONAR-2255 the metric 'classes' must not be 0 on unit tests --- diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/decorators/ClassesDecorator.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/decorators/ClassesDecorator.java index 11501ba7a6b..1ff4d0ead80 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/decorators/ClassesDecorator.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/decorators/ClassesDecorator.java @@ -23,15 +23,12 @@ import org.sonar.api.batch.Decorator; import org.sonar.api.batch.DecoratorContext; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; -import org.sonar.api.resources.Java; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.Resource; -import org.sonar.api.resources.Scopes; +import org.sonar.api.resources.*; public final class ClassesDecorator implements Decorator { public void decorate(Resource resource, DecoratorContext context) { - if (Scopes.isFile(resource)) { + if (Scopes.isFile(resource) && !Qualifiers.UNIT_TEST_FILE.equals(resource.getQualifier())) { int classes = 0; for (DecoratorContext child : context.getChildren()) { if (Scopes.isProgramUnit(child.getResource())) {