Skip to content
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

Allow a psalm error to kill a mutant when the error and the mutant are located in two different files. #486

Open
bdsl opened this issue Nov 17, 2023 · 3 comments

Comments

@bdsl
Copy link

bdsl commented Nov 17, 2023

I'm not sure if this is feasible without slowing infection down intolerably, or necassarily even desirable, but reporting here to make the issue clear.

Currently this plugin only allows Psalm to kill a mutant if both are in the same file, because the implementation works by having Psalm analyse only the given file relevant to each mutant. But conceptually it seems quite arbitrary to score code more highly if Psalm errors appear in the same file mutated rather than in a different file - there's nothing that special about the file to file boundary.

Allowing Psalm to kill mutants in a different file would probably significantly increase MSI scores in many projects - mutations like PublicVisiblity would generally be killed whenever a public method is used and required to be public anywhere within the project being analysed, even if none of the code that uses the method has any tests.

If it's not feasible to fix this I'd be happy to make a PR to add info about it to the docs.

@Ocramius
Copy link
Member

It would be possible to have this as an option, IMO: the default behaviour is slow enough, but I can see how this would be useful too, sometimes.

I would leave this be, for now: it feels impractical 🤔

@bdsl
Copy link
Author

bdsl commented Nov 17, 2023

@Ocramius Do you think it'd be worth documenting the behaviour though? I can do a docs PR.

@Ocramius
Copy link
Member

Certainly 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants