stryker-js icon indicating copy to clipboard operation
stryker-js copied to clipboard

first stab at statementRemoverMutator #3913

Open magwas opened this issue 2 years ago • 13 comments

This is a preview. Works for me because the code I am using it with is really small and primitive. I would like to get some feedback on which statements to remove, and which ones not to remove. And ofc on the general direction. I intend to work on the project with which I use stryker, and update the mutator in an as-needed basis, and also incorporate feedback here.

magwas avatar Dec 24 '22 18:12 magwas

I would love this mutator. Stryker.NET also has it, but they call it the block statement mutator if I'm not mistaken.

It has an additional feature, which I would love. Statements are not removed when there are other mutants generated anywhere in the statement. I view that as a requirement for this mutator because it would otherwise generate many mutants of low quality.

@richardwerkman @rouke-broersma could one of you elaborate on how that works in Stryker.NET? Do you generate mutants and later decide which ones to keep, filtering out these low-quality mutants? Or did you make the "block statement" mutator "smart"?

nicojs avatar Dec 25 '22 10:12 nicojs

No we have both. We call them removal mutators. Statement and block: https://stryker-mutator.io/docs/stryker-net/mutations/#removal-mutators-statement-block

rouke-broersma avatar Dec 25 '22 10:12 rouke-broersma

It has an additional feature, which I would love. Statements are not removed when there are other mutants generated anywhere in the statement. I view that as a requirement for this mutator because it would otherwise generate many mutants of low quality.

As I understand there is no info in the mutator itself to decide on it. Ofc. it is an option to modify the calling code.

I consider that feature as an optimization. First I concentrate to get the functionality together.

magwas avatar Dec 25 '22 11:12 magwas

No we have both. We call them removal mutators. Statement and block

@rouke-broersma do you have a way to make sure these mutants are generated when there are no other mutants generated in the (block)statement?

nicojs avatar Dec 25 '22 20:12 nicojs

Not sure on the specifics of the implementation, @richardwerkman ?

rouke-broersma avatar Dec 26 '22 14:12 rouke-broersma

The specifics of the implementation are: we don't have an implementation... I wanted to add that but so far without success. For now, we place these mutations all the time. Despite it generating some unwanted mutants.

I had some ideas like filtering the mutants after generating them. Or keeping track of context and passing a value to mutators that helps identify if a mutant has been placed in this scope already.

richardwerkman avatar Dec 28 '22 13:12 richardwerkman

I've created an issue at stryker-net for this: https://github.com/stryker-mutator/stryker-net/issues/2367

richardwerkman avatar Dec 28 '22 13:12 richardwerkman

I added my experiment for functioncall remover mutator here as well #3920

magwas avatar Dec 31 '22 22:12 magwas

I have updated the snapshots, fixed eslint problems (not mine), and a couple of tests (one was not mine). Now npm run all runs okay. There are some errors in npm run e2e. I have no idea what causes them or how to fix them.

This is the point when I consider this pull request ready.

If anything else is needed for acceptance, I need guidance.

magwas avatar Feb 23 '23 18:02 magwas

Any news with this PR? If anything should be fixed to make it acceptable, please let me know.

magwas avatar Mar 04 '23 14:03 magwas

Anything I can do to get this pull request accepted?

magwas avatar Mar 11 '23 13:03 magwas

Anything I can do to get this pull request accepted?

magwas avatar Mar 25 '23 07:03 magwas

I've opened issue #4463. We should tackle it during hacktober. I think that should be implemented before we can merge this PR.

nicojs avatar Oct 03 '23 09:10 nicojs