aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stipicevic <mst@ableton.com>2018-04-16 17:09:38 +0200
committermst <mst@ableton.com>2018-04-19 18:54:12 +0200
commite1766284cfe183562fc25adc34b220d4bb5643a9 (patch)
tree7b2d694daa1128ead5094129c74d9932f86fce02
parentd059cc4fcf3156f6f7ac3b3408ed86535751500e (diff)
downloadyapf-e1766284cfe183562fc25adc34b220d4bb5643a9.tar.gz
Add and update documentation about return codes
-rw-r--r--README.rst11
-rw-r--r--yapf/__init__.py3
2 files changed, 13 insertions, 1 deletions
diff --git a/README.rst b/README.rst
index ccc74d9..f67f72e 100644
--- a/README.rst
+++ b/README.rst
@@ -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.