Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin is marking excluded classes as uncovered #24

Open
rschaeferhig opened this issue Aug 29, 2018 · 8 comments
Open

Plugin is marking excluded classes as uncovered #24

rschaeferhig opened this issue Aug 29, 2018 · 8 comments

Comments

@rschaeferhig
Copy link

We just upgraded from an older version of the plugin running in Sonarqube 5.6.6 to the latest running in 6.7. We have a number of Maven builds that excluded classes from Cobertura. The developers report that prior to the Sonarqube/plugin upgrade the excluded classes were not counted/reported in Sonarqube. After the upgrade the classes are showing as uncovered.

It appears that in earlier versions a class in the source code not reported in Cobertura was ignored in Sonarqube. Was there a change such that a class defined in the code that was not reported at all in coverage.xml now shows as uncovered?

@galexandre
Copy link
Owner

Hi,

As far as I remember the refactor performed shouldn't have change the behaviour of that.
How do you exclude the class?

Regards,

@rschaeferhig
Copy link
Author

They do something like this in their POM

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <configuration>
          <instrumentation>
            <!-- Ignore basic getters/setters, don't count in code coverage -->
            <ignoreTrivial>true</ignoreTrivial>
            <!-- Ignore basic logging statement, don't count in code coverage -->
            <ignores>
              <ignore>org.apache.log4j.*</ignore>
              <ignore>org.slf4j.*</ignore>
              <ignore>org.apache.logging.*</ignore>
            </ignores>
            <!-- Ignore methods annotated as being covered in Integration tests -->
            <ignoreMethodAnnotation>com.thehartford.sp.common.service.IntegrationTested</ignoreMethodAnnotation>
            <!-- Ignore methods annotated as not able to cover in test, such as certain no-op and empty methods required by implemented interfaces -->
            <ignoreMethodAnnotation>com.thehartford.sp.common.util.CoverageIgnore</ignoreMethodAnnotation>
            <excludes>
              <exclude>com/thehartford/venture/entities/**/Abstract*.class</exclude>
              <exclude>com/thehartford/venture/entities/**/*DAO.class</exclude>
              <exclude>com/thehartford/venture/entities/**/*VwId.class</exclude>
              <exclude>com/thehartford/venture/entities/filters/EntityManagerHelper.class</exclude>
              <exclude>com/thehartford/venture/**/package-info.class</exclude>
              <exclude>com/thehartford/venture/dataServices/CommonReportService.class</exclude>
            </excludes>
          </instrumentation>
        </configuration>
      </plugin>

Which excludes those classes from Cobertura. Prior to the upgrade they wouldn't show up at all in Sonarqube under Coverage. Now they show up as zero coverage.

@rschaeferhig
Copy link
Author

Coverage from Sonarqube. I don't have prior since we converted and I didn't keep the old site.
coverage

@galexandre
Copy link
Owner

Okay I see. I didn't test this scenario to be honest.
I am trying to find any changes that would impact the behaviour in te merge request (https://github.com/galexandre/sonar-cobertura/pull/22/files)

@rschaeferhig
Copy link
Author

Could be that it's not something you did in the PR but something that changed in Sonarqube with 6.x that the plugin doesn't account for...

@galexandre
Copy link
Owner

In this case you need to open a ticket in the Sonar forum.

@rschaeferhig
Copy link
Author

If it was a change in Sonarqube that needs to be accounted for in the plugin then wouldn't it be a plugin change, not a Sonar change? Missed use case?

@galexandre
Copy link
Owner

As I said I didn't test the use case. I will have a look in Sonar documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants