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

Add support for coverage thresholds and tolerance of minor drops in coverage in Github status checks #89

Conversation

michael-fredrickson
Copy link

This pull request adds two new features which are adding support for Github status checks with the defined coverage threshold as well as a tolerance option to address minor drops in code coverage which can fail a build outlined in issue #84.

Here are some screenshots of the default behavior as well as demonstrations of each of these two features passing and failing a build.

Default:
Normal_Result

Thresholds:
Failing_Threshold
Passing_Threshold

Tolerance:
Failing_Tolerance
Passing_Tolerance

@michael-fredrickson michael-fredrickson force-pushed the storpeyCHT/compare-with-tolerance branch from 6941080 to c4dd08c Compare August 20, 2020 13:47
@michael-fredrickson michael-fredrickson force-pushed the storpeyCHT/compare-with-tolerance branch from c4dd08c to d6b4c8b Compare August 20, 2020 13:48
@msabramo
Copy link
Contributor

msabramo commented Dec 9, 2020

👍   to this idea!

This is pretty cool, but I'm wondering if it would be better if the tolerance were specified in the pipeline step (as comparisonMode is) rather than in the global settings. It seems really useful to have different tolerances for different builds, including for different branches on a multi-branch project.

statusMessage = message.forThresholdStatusCheck( settingsRepository.getGreenThreshold() );
} else if ("tolerance".equalsIgnoreCase(comparisonMode)){
float tolerance = settingsRepository.getTolerance();
float result = Math.abs(coverage - targetCoverage) * 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, because it will result in coverage increases causing failures. I think this should be:

float result = (targetCoverage - coverage) * 100;

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

Successfully merging this pull request may close these issues.

3 participants