PR analysis for Code Coverage includes files not changed in the Pull Request


We have connected SonarQube with Github and amongst the things we require is Code Coverage.
We are using jacoco for report generation and SonarQube Developer Edition Version 7.7 (build 23042) for a multi-module, java, maven-built project.
Current status is:

  • Analysis works ok,
  • covers jUnits and ITs
  • master branch is scanned correctly

PR Code Coverage analysis shows files that were not part of the PR at all. Meaning the developer did not alter them.
Such false positives usually are recently changes classes but we have seen older classes as well, that haven’t changed in months.
Code Coverage is reported correctly, what is wrong is having a list of 10-15 .java classes unrelated to your changes and having to analyse them to understand what is happening.

Any advice or redirection to documentation is appreciated.
Worst case scenario, can we mark such reported files as “False Positive” to avoid seeing them in the report and calculating accurately the Code Coverage %?


1 Like

Hi Dimitris,

Could you show us the logs of the scanner (preferably with debug enabled) of one the analysis of the P/R that has files that shouldn’t be there?
There are a couple of things that could go wrong while scanning the project and that would help us narrow it down.