ruff check --fix may create some fixes that get normalized out in the actually_mutated check.
If the only fixable errors get normalized out such that mutated is True but actually_mutated is False, the output code is forced to 0, assuming that the present mutations are the only reason for the nonzero exit code, which may not be true, resulting in incorrectly successful hooks.
The only workaround I've figured out is to run it twice, once with --fix and again without.
ruff check --fix
may create some fixes that get normalized out in theactually_mutated
check.If the only fixable errors get normalized out such that
mutated
is True butactually_mutated
is False, the output code is forced to 0, assuming that the present mutations are the only reason for the nonzero exit code, which may not be true, resulting in incorrectly successful hooks.The only workaround I've figured out is to run it twice, once with
--fix
and again without.