nbQA-dev / nbQA

Run ruff, isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks
https://nbqa.readthedocs.io/en/latest/index.html
MIT License
1.05k stars 41 forks source link

exit code is 0 on failed "ruff check --fix" #872

Open minrk opened 3 weeks ago

minrk commented 3 weeks ago

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.

MarcoGorelli commented 3 weeks ago

sure sounds good