-
Notifications
You must be signed in to change notification settings - Fork 187
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
calculate mutation score only of changed lines of code in a file from pull requests #3077
Comments
Hi
As said earlier, filtering this result only for new or modified mutations would yield incorrect result. That being said, the current logic still relies on a coarse granularity logic (file level). As such, we may look into on how to refine this granularity. We can get some line level diff level info, but this will remain more difficult to leverage for mutation coverage than it is for line coverage. |
Thanks for your prompt response @dupdob
I do not get why would the mutation score be incorrect considering the above factors. I am happy to discuss and understand more with you on this. |
To be precise: when I say that marginal scores (line coverage or mutations), I mean you cannot accurately determine the coverage score for the whole source base using only baseline and marginal scores. void SomeComplexMethod(....)
{
....
} which is 100% covered. void SomeComplexMethod(....)
{
if (somethingAlwaysTrue)
return;
....
} Modified lines are: if (somethingAlwaysTrue)
return; Line coverage for this is 100%. Baseline coverage is 100%, but if you test for the whole codebase, you actually discover that none of the original code lines are actually covered. Yes, my example is extreme, and you could argue that unit test should be broken after such an important change. Just to be clear, I am not against using marginal coverage as an attribute. I just wanted to stress out its limitations. Now, focusing on the feature request:
The part regarding test is important, because this means that there will always be a significant number of 'non changed' mutant that will be reevaluated, which means your marginal score will be significantly skewed by your baseline score. |
Is your feature request related to a problem? Please describe.
I wanted to use stryker in the pipeline such that when someone raises a new Pull Request stryker calculates mutation score of only the changed lines of code and not the entire file. By doing this, I want to enfore a restriction that if the mutation score of the changed lines in the PR is less than say 80% the build should fail. I tried baseline and since feature but both does not calculate mutation score based on only the changed lines instead it calculates mutation score for entire changed file which doesn't work in my case.
Describe the solution you'd like
I would want a simple config that when passed in stryker-config or command line takes only the changed lines of code and returns the mutation score for the changed lines only.
Describe alternatives you've considered
I have consideried using -m config and gave line span manually by giving -m filename.cs{line1..line2} but even this does not work for me. neither does the since or baseline feature works as they calculate mutation score for entire file chnaged.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: