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

Jacoco report target filtering. #6736

Merged
merged 4 commits into from Nov 12, 2018

Conversation

Projects
None yet
3 participants
@jtrobec
Contributor

jtrobec commented Nov 8, 2018

Adds an argument for the jacoco jvm coverage processor that filters targets included in reports using a list of regular expressions.

Problem

The current implementation of jacoco code coverage will produce a report that includes all targets used in the test run. This includes targets not directly under test, but dependencies of the package actually under test. As a result, there's a lot of undesirable noise in the reports.

Solution

Introduce a parameter to filter the class files supplied to the jacoco cli when the report is produced. The jacoco cli does not provide a native parameter for exclusions, and instead the best we can do is to exclude class files when generating the reports. Classes that aren't passed to the cli during report generation aren't included in the resulting report.

The parameter I've added is a list of regular expressions. When specified, pants will only pass targets that match one of the regexes to the cli during report generation. Any target that doesn't match the pattern will be excluded, and thus not show up in the report.

Adds an argument for the jacoco jvm coverage processor that filters t…
…argets included in reports using a list of regular expressions.

@stuhood stuhood requested a review from jsirois Nov 8, 2018

jtrobec added some commits Nov 9, 2018

Moves new argument to subsystem scope. Applies target filter to cover…
…age targets earlier. Cleans up test project build files.
Adds a fake target when running coverage related junit tests so that …
…Jacoco doesn't complain that it's instantiated with an empty set of test targets.
@stuhood

Thanks, looks good! Will merge on green.

@stuhood

This comment has been minimized.

Member

stuhood commented Nov 12, 2018

You hit a flaky test. Going to merge. Thanks!

@stuhood stuhood merged commit b31bef7 into pantsbuild:master Nov 12, 2018

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

@jtrobec jtrobec deleted the jtrobec:jtrobec/pants/jacoco-report-filtering branch Nov 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment