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
Disable certain mutators for certain lines #79
Comments
Perhaps an obvious workaround - make sure you have a unit test that calls the |
Hello,
This is really my one of the most wanted feature. Let's start discussing a possible implementation. The first thought was the same - add something like other tools add in PHP and JS world: // tslint: disable-next-line
...
// infection:disable FunctionSignature but now I don't like this idea because
I like the idea of PHPStan -https://github.com/phpstan/phpstan#ignore-error-messages-with-regular-expresions. They use patterns/regular expressions on the config level to skip/ignore some issues during analyzing. We can use this idea and implement something similar, for example: Ignore mutators for some class// infection.json
{
"mutators": {
"ignore": {
"PublicVisibility": [
"Ignore\For\Particular\Class",
"Ignore\For\Another\Class::method",
// ...
"Ignore\For\**\*\Glob\Pattern\Or\Namespace"
]
}
}
} Also, I think keeping the exact line number in the "ignore config" is a bad idea because line numbers change quite often What I also like and want to have from PHPStan is the behaviour of notifying users when some of the ignored classes/methods for mutants are no longer exist (see https://github.com/phpstan/phpstan#ignore-error-messages-with-regular-expresions): for example if the |
For WordPress, callback methods hooked into the actions or filters need to be
public
.The
Function Signature
mutator naturally tries to change the callback frompublic
toprotected
, and flags it as a "not covered mutant".Is there any way (to reduce known false positives) to specify that a method really should stay
public
, either by adding a line comment (e.g.// infection:disable FunctionSignature
) or by adding an exclusion (file and line number? class and method name?) toinfection.json.dist
?The text was updated successfully, but these errors were encountered: