diff options
author | Mike Stipicevic <mst@ableton.com> | 2018-04-16 17:09:38 +0200 |
---|---|---|
committer | mst <mst@ableton.com> | 2018-04-19 18:54:12 +0200 |
commit | e1766284cfe183562fc25adc34b220d4bb5643a9 (patch) | |
tree | 7b2d694daa1128ead5094129c74d9932f86fce02 | |
parent | d059cc4fcf3156f6f7ac3b3408ed86535751500e (diff) | |
download | yapf-e1766284cfe183562fc25adc34b220d4bb5643a9.tar.gz |
Add and update documentation about return codes
-rw-r--r-- | README.rst | 11 | ||||
-rw-r--r-- | yapf/__init__.py | 3 |
2 files changed, 13 insertions, 1 deletions
@@ -126,6 +126,17 @@ Options:: -vv, --verbose Print out file names while processing +------------ +Return Codes +------------ + +Normally YAPF returns zero on successful program termination and non-zero otherwise. + +If ``--diff`` is supplied, YAPF returns zero when no changes were necessary, non-zero +otherwise (including program error). You can use this in a CI workflow to test that code +has been YAPF-formatted. + + Formatting style ================ diff --git a/yapf/__init__.py b/yapf/__init__.py index 0322b31..6281f07 100644 --- a/yapf/__init__.py +++ b/yapf/__init__.py @@ -49,7 +49,8 @@ def main(argv): in argv[0]). Returns: - 0 if there were no changes, non-zero otherwise. + Zero on successful program termination, non-zero otherwise. + With --diff: zero if there were no changes, non-zero otherwise. Raises: YapfError: if none of the supplied files were Python files. |