modernize
modernize copied to clipboard
Fail if changes are required
It would be useful to use python–modernize in CI setups if it could fail when changes are required. Currently the return code is always 0 unless an error occurred during execution.
I'd suggest a --fail-if-changes-required flag, mutually exclusive with --write, that has return code 1 if changes are required.
That sounds like a good idea. As a workaround for lack of this feature, you can use -z in bash (http://stackoverflow.com/a/12137504/393146) to check that the output of python-modernize without the --write flag is empty.
Why not just return 1 if changes are required and --write is not specified?
That would be a breaking change and could disrupt many CI scripts/tools out there.