Feature: Implements the treat-unmeasured-as-uncovered flag#581
Closed
aweidner wants to merge 3 commits intoBachmann1234:mainfrom
Closed
Feature: Implements the treat-unmeasured-as-uncovered flag#581aweidner wants to merge 3 commits intoBachmann1234:mainfrom
treat-unmeasured-as-uncovered flag#581aweidner wants to merge 3 commits intoBachmann1234:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's possible for coverage files to omit lines from a diff entirely rather than indicating that they were not hit. This pull request introduces a new flag to allow optionally counting these occurrences towards uncovered lines.
Current behavior
This diff for example
Along with this fragment of coverage in the lcov xml format:
In this example, line 611 appears in the diff, but does not appear at all in the
coverage.xmlfile. When diff-cover is run against this combination, we get the following outputBecause only one line is in common between the diff and the coverage information. With the existing behavior, the xml file would need to contain
hits="0"lines as such:In order to detect all of the changes in the diff, not just the ones that were executed.
New behavior
This pull request proposes a new flag
--treat-unmeasured-as-uncovered(I'm open to renaming this). When set, this flag detects any unmentioned non-whitespace lines in the diff as being uncovered and reports them. For the example above, the output is:Existing behavior is unchanged when the flag is off, preserving the old functionality for anyone who does not opt-in.