stryker-mutator / stryker-handbook

A comprehensive guide to the stryker ecosystem
Apache License 2.0
71 stars 11 forks source link

Allign the naming of mutators #11

Closed richardwerkman closed 5 years ago

richardwerkman commented 5 years ago

Currently the list of mutators says:

The list should become (proposal):

It is pretty inconsistant. Some have "mutator" in their name, others don't. Some say what the mutator does (Remove conditionals), others just describe what kind of operators they target.

I think we should make this list more consistant, and use a format for each mutator name.

Maybe all should be called mutator? Or all should describe what kind of statements/expressions they mutate. What do you guys think?

hugo-vrijswijk commented 5 years ago

I am all for this! Perhaps we could also look at the current list of categories. Binary operators is by far the biggest, while in my mind a + b and a > b are quite different. And the Logical operators category looks a little lonely with just 2 mutators

nicojs commented 5 years ago

Binary operators is by far the biggest, while in my mind a + b and a > b are quite different

Agreed. What do you think of this:

Than it will fit nicely with "Logical Operators"

It is worth noting, if we are going to call the Mutators by the type of node they are mutating, that the technical name can differ between the different kind of AST's (Scala, JS, TypeScript and C#). For example: a ArithmeticOperatorNode does not exist in the JS/TS AST. We should all agree on the name here and implement them as such, regardless of technical names of the AST.

All in all this should be the new list in my opinion:

All singular, without the mutator postfix (I think it does make sense for the class names that implement them to have the Mutator post fix)

@hugo-vrijswijk @simondel @richardwerkman do you agree?

richardwerkman commented 5 years ago

@nicojs Your list looks great, only "Control statement" isn't clear for me. Shouldn't this be "Conditional expression"?

nicojs commented 5 years ago

"Control statement" as in Control flow or Control statement.

I feel a "Conditional expression" is more the part inside the parenthesis of the for/while/if statement.

hugo-vrijswijk commented 5 years ago

Yeah we should definitely keep the names non-language specific (the node names are pretty general in Scala, compare, arithmetic, method are all the same, it's just syntax sugar).

Compare and equality are also similar, in my opinion (and we even mutate them to each other), so I'd put those together.

I feel a "Conditional expression" is more the part inside the parenthesis of the for/while/if statement.

But isn't that exactly what the mutators are doing?

We could put the literals together, but I also feel like keeping them separate is good if the user wants to disable a certain category (when that's supported for each framework).

Overall I think the list is great!

nicojs commented 5 years ago

Compare and equality are also similar, in my opinion (and we even mutate them to each other), so I'd put those together.

So the name should be "Equality Operator" ?

But isn't that exactly what the mutators are doing?

Wow I guess you're right. So let's call it "Conditional expression". @richardwerkman do you want to update your original issue, so we can view the current mutator proposal names?

richardwerkman commented 5 years ago

@nicojs @hugo-vrijswijk I have updated the list in the issue to fit your comments. I'm still doubtfull about the Method expression, since it is not an actual expression, more of a identifier for the method to invoke. It could become Method call or Method identifier. What is your thought?

nicojs commented 5 years ago

Good point. We should maybe group the methods as well. Otherwise that group might become too big. @hugo-vrijswijk any thoughts on how to group them? Since Stryker4s will probably have the most of these mutator? For C#, we might be able to group all LINQ expression mutations in a Linq Method Call.

hugo-vrijswijk commented 5 years ago

Method Call I think is a good descriptive name. Most of the current method mutators for Stryker4s are on collections/monads and I don't think those can be split up much more. I don't think we should make categories that are language-specific like Linq method call or something. It might get a little big, but anything under, say, 30 mutators still has overview, in my opinion

legopiraat commented 5 years ago

Is there a definitive list yet?

nicojs commented 5 years ago

I think so. Who makes the PR?

richardwerkman commented 5 years ago

Stryker.NET already implemented the list. So yeah making this list definite seems right for me!

hugo-vrijswijk commented 5 years ago

One final suggestion, looking at the list. Array declarator literal is a bit long. Maybe we could change it to just Array Declaration?