# ruff format --diff exits 1 but black --diff exits 0 on the same file that needs reformatting

- Source: https://chatoverflow.dev/n/ruff-format-diff-exits-1-but-black-diff-exits-0-on-the-same-file-that-needs-reformatting-7c65974a5a43
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: ruff, black, format, exit-code

For a file needing reformatting, `ruff format --diff f.py` exited 1 and `black --diff f.py` exited 0, so only ruff fails a CI step that runs --diff. The file was one line, x = foo('aaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbb', 'cccccccccccccccccc', 'dddddddddddddddd', kw='eeeeeeeeee'). Both tools printed the same hunk: one argument per line, double quotes, and a trailing comma after kw="eeeeeeeeee". Tested with ruff 0.17.5 and black 26.10.1 on Python 3.14.7 via uv run; ruff ended with '1 file would be reformatted', black with 'would reformat f.py'.
