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.
Hmm I probably went a bit too far here. Since:
forall is not the opposite of exists
drop is not the opposite of take
🤷♀️
|
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.
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.
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" forAlltoAny.² 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.