-
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
docs(mutators): add mutant operator name proposal #1458
Conversation
docs/supported-mutators.md
Outdated
| MaxMethodCallNegation | `a.max` | `a.min` | | ||
| MinMethodCallNegation | `a.min` | `a.max` | | ||
| MaxByMethodCallNegation | `a.maxBy(b)` | `a.minBy(b)` | | ||
| MinByMethodCallNegation | `a.minBy(b)` | `a.maxBy(b)` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I probably went a bit too far here. Since:
forall
is not the opposite of exists
drop
is not the opposite of take
🤷♀️
docs/supported-mutators.md
Outdated
| ------------------------------------------------ | ----------------------------- | ----------------------------- | | ||
| LogicalAndOperatorNegation | `a && b` | <code>a || b</code> | | ||
| LogicalOrOperatorNegation | <code>a || b</code> | `a && b` | | ||
| NullishCoalescingOperatorToLogicalAndReplacement | `a ?? b` | `a && b` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Nullish" is not a concept in the .NET world, and I wouldn't know what to expect from this. Although I don't have a better idea, maybe only something even more verbose like "NullNullishCoalescingOperatorToLogicalAndReplacement".
(just passing by here - actually I think all this PR is a good idea)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Nullish makes sense anyway. The end result is that the value is treated in such a way that it is the same as Null, so NullCoalescing is good enough imo.
I would propose to remove the syntax type and other classifiers (negation, operator, expression etc) where possible. For example:
In the spirit of KISS, I think we should simplify where possible. |
Proposal has been extended in #2995. |
I've changed the PR based on a conversation we just had. Attendees: @hugo-vrijswijk @rouke-broersma @richardwerkman @xandervedder
|
| FilledInterpolatedStringToEmpty | `s"foo ${bar}"` (string interpolation) | `s""` ¹ | | ||
| FilledInterpolatedStringToEmpty | `\`foo ${bar}\`` | `\`\`` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines break the website build: https://github.com/stryker-mutator/stryker-mutator.github.io/actions/runs/8295994425/job/22704167287#step:7:39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, sorry! #3066 fixes that.
Btw, it's not the line breaks, but the way of escaping backticks.
A proposal for mutant operator names. They are loosely based on the naming scheme found in infection PHP and pitest.
The goal of each mutant operator name is to have a conclusive name that describes the mutation. I used the following naming scheme:
*NodeIdentification*[To*Replacement*]*Mutation*
NodeIdentification
: Name the AST node being mutated.Mutation
: Name the mutation being done:<
to<=
)Replacement
(only when the mutation was "Replacement"), name the node being replaced to ²¹ I choose to interpret the "opposite" loosely here. When in doubt, I decided to use it. For example: "AdditionAssignmentNegation" for
+=
to-=
and "AllMethodCallNegation" forAll
toAny
.² When naming the replacement node, I removed "expression", "operator" and "method call" for brevity. For example: "SingleOrDefaultMethodCallToFirstOrDefaultReplacement" and "NullishCoalescingOperatorToLogicalAndReplacement".
When identifying AST nodes, I did lean towards the JavaScript node types. Please verify if this is OK for C# and Scala, if not, please correct me. I used the following sources:
We also have mutations that replace a part of a node, instead of the node itself. I had to invent logical names for them. They are summed up here:
I didn't do all of them, because I first want feedback on these names.