Class-level exclusions and mutation options
See original GitHub issueIs your feature request related to a problem? Please describe. We have a set of helper functions in an library we reference related to argument validation, each which takes an optional message that will eventually become the exception message. It’s quite frustrating that Stryker marks the strings as survived mutants as we don’t check the messages in our tests (and it would be an undertaking to do so)
Requires.NotNull(arg1, nameof(arg1), "optional message");
Requires.Argument(arg2 > 0, nameof(arg2), "optional message");
Requires.Range(arg3, 0, 5, nameof(arg3), inclusive: true, "optional msg");
These methods exist in pretty much all of our public (and some internal) API so it’s lot of noise to have to deal with.
Describe the solution you’d like Ideally I’d like a way to exclude an entire class (rather than just the method names) since in this case the majority of checks are null tests.
Another option would be a way to tweak mutations at the class/method level (ie. don’t apply string mutations). As you can see in the examples above, I don’t really care about the string mutations but If I could, I’d probably want to keep the <
mutation on the Argument
method and the false
mutation on the Range
method… but really I’d settle (sigh) for excluding the entire class altogether if only to remove the noise of the string mutants.
Describe alternatives you’ve considered
The class in question only has a handful of methods, so I could just list them out in the config file, but I’d have to do so for every project. If I add new methods I’d have to make sure to update everything. The names are fairly generic in some cases (we have an IsDefined
for enums) so there’s still some chance of some conflicts using method name only.
Another option would be to disable string mutations altogether. We’ve not explored that option yet, but based on what we’ve been seeing so far this may be a viable alternative.
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (12 by maintainers)
Alright, thanks for calming me down 😃
@psfinaki I don’t mind when you ask for a release and it’s not a lot of effort. It’s more that historically we haven’t released every commit unless it had been some time in between or there is a specific need such as in this case. So I often forget to release 🤷♂️. I’m happy you remind us to release stuff no worries.