modernize icon indicating copy to clipboard operation
modernize copied to clipboard

Fail if changes are required

Open adamchainz opened this issue 9 years ago • 3 comments

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.

adamchainz avatar Apr 27 '16 13:04 adamchainz

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.

daira avatar May 01 '16 16:05 daira

Why not just return 1 if changes are required and --write is not specified?

techtonik avatar May 02 '16 15:05 techtonik

That would be a breaking change and could disrupt many CI scripts/tools out there.

adamchainz avatar May 02 '16 21:05 adamchainz