-
Notifications
You must be signed in to change notification settings - Fork 21
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
Commented out code marked as mutated in html report #1931
Comments
Stryker uses Roslyn to parse the source and then mutate the resulting syntax tree. Actually it cannot mutate commented out code, because Roslyn reports it as comments, which are not mutated. What you see here is the mutation for the whole code block, it appears in green below. Block mutations do not preserve comments. |
We should move this to mutation testing elements. It can be confusing to see a comment marked as being a part of a mutation and users might interpret this as commented code being mutated. |
I'm not sure what would be a good solution here. I'd be happy to hear suggestions. IMO marking the whole block as NoCoverage makes sense, because the entire block has no coverage. It's different from e.g. just the Also, on a technical level I think this could be fairly complex to implement and make exclusions for |
Side comment: not sure why this mutation happened since I have added a logic preventing mutating bloc with a single statement, as it doubles with the statement mutator. Is this a problem only because there is code in the comment ? What about code in a string ? Would people expect it to be mutated as well. This problem exists (as well as other) because users have strong assumptions about how Stryker works (by altering source code text). Just thinking out loud here, not saying nothing should be done, but I tend to think somehow excluding the comment is not the best way to address this concern. |
Perhaps we could add an optional property to the schema for lines that are included for visual reasons only. It would then be up to the tool to decide which lines if any are not mutated code. |
I think it is only a problem because there is code in a comment. You're refactoring, you're commenting out some code you want to remove etc yet in the mutation report or appears as if the code was active. |
Describe the bug
It seems that code that is commented out when part of a block mutation is marked as mutated code. I think the report should ignore lines that are comments from the visualisation.
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: