0

I am using sonar in my project through sonar-maven plugin . I am using Cobertura plugin for code coverage analysis. I want to exclude some modules/classes from code coverage report.

How can I do it? Thanks in advance.

  • This answer might help you: http://stackoverflow.com/a/7760960/1377224 you may simply add for the fileset to test an exlude list. – philnate Apr 15 '13 at 12:01

1 Answers1

1

You can use the sonar.coverage.exclusions to not report coverage of some files of your project.

You can find this property in the project settings, in the "Exclusions > Code Coverage" category.

enter image description here

  • Actually i don't want to exclude test files from analysis. I want to exclude some package/module which excluded because unit test cases for those modules have not been written. – user2282340 Apr 19 '13 at 05:11
  • Hi Fabrice, so is there no intention to support test coverage exclusions separate from analysis exclusions? We have source code that should be analysed for coding styles, but can only tested in system tests and thus will never get code coverage in the nightly build. It would help us to get rid of these files in the coverage report to see only the business logic we want to test in this scenario - what is not possible at the moment. – dag Sep 10 '15 at 09:19
  • Hi @dag , this feature has been implemented since the time I answer this question. So I've updated the answer. – Fabrice - SonarSource Team Sep 10 '15 at 13:08
  • Great and thank you for the hint! You may also include that in the documentation: http://docs.sonarqube.org/display/SONAR/Analysis+Parameters#AnalysisParameters-Exclusions/Inclusions – dag Sep 14 '15 at 11:02