Repository navigation
fix(analyzer): remove ExcludeFromCodeCoverage so Stryker mutates analyzers - #680
Merged
Merged
Conversation
…yzers
Stryker drops every mutant in types carrying [ExcludeFromCodeCoverage]
("Removed by exclude from code coverage filter"), so all NED/OLD analyzer
logic was invisible to mutation testing. 25 tests already exercise both
classes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #680 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 1 3 +2
Lines 16 134 +118
Branches 1 15 +14
==========================================
+ Hits 16 134 +118 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
The mutation run reports a score of 33.33%, but it only measures
Helper.cs.246 mutants got status Ignored. Reason: Removed by exclude from code coverage filter(plus 6 "block already covered")10 total mutants will be testedof 294 created (3 mutated variant projects: Roslyn4_7, Roslyn4_14, Roslyn5_6)final mutation score is 33.33 %IsPackableProjectDiagnosticAnalyzer.csIgnored 59 + CompileError 4,OldProjectSupportDiagnosticAnalyzer.csIgnored 23,Helper.csKilled 10 + Ignored 2.Root cause
Both analyzer classes carry
[ExcludeFromCodeCoverage]. Stryker honours that attribute and removes all mutants in those types. The only real production logic (NED0001-0009, OLD0001) is therefore never mutated, although 25 tests exercise it. Thestryker-config.jsonmutate globs do not exclude these files, so the attribute is the only cause.Change
Remove
[ExcludeFromCodeCoverage]and the now unusedusing System.Diagnostics.CodeAnalysis;from both analyzers. No other coverage exclusion config exists in the repo (the CodeCoverage package is referenced only by test projects).Before / After
Run: https://github.com/dailydevops/defaults/actions/runs/40804488424
The attribute-driven ignores dropped from 246 to 0 and tested mutants rose from 10 to 98 (75 killed, 3 survived). The score barely moves because the Roslyn4_14 variant still finds 0 tests ("Number of tests found: 0"), so its mutants (plus others) became NoCoverage (136). That is a separate problem and needs its own fix. The 3 survivors point to concrete test gaps and are not addressed here.
Risk / what this does not change