]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2255 the metric 'classes' must not be 0 on unit tests
authorsimonbrandhof <simon.brandhof@gmail.com>
Wed, 20 Apr 2011 13:25:30 +0000 (15:25 +0200)
committersimonbrandhof <simon.brandhof@gmail.com>
Wed, 20 Apr 2011 13:26:55 +0000 (15:26 +0200)
plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/decorators/ClassesDecorator.java

index 11501ba7a6b029eb9ae6bf38ec24fc198bde5826..1ff4d0ead8028810acf0e7ca565f7089c402ed9f 100644 (file)
@@ -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())) {