summaryrefslogtreecommitdiffstats
path: root/contributing.md
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2018-04-08 17:54:55 -0500
committerGunnar Mills <gmills@us.ibm.com>2018-04-10 14:01:22 +0000
commitf1b07cec5e1b854989a1b07cd05d4b74a9be94e7 (patch)
treed950b67460040322fa3761301b5ede549587abfb /contributing.md
parentf14504e4708531c31da6c6edb608ecf5f537b9b2 (diff)
downloadopenbmc-docs-f1b07cec5e1b854989a1b07cd05d4b74a9be94e7.tar.gz
openbmc-docs-f1b07cec5e1b854989a1b07cd05d4b74a9be94e7.zip
Move Python Formatting to contributing.md
Moved the Python Formatting section from cpp-style-and-conventions to contributing. cpp-style-and-conventions is meant for C++ code only. Change-Id: I23b1fcd5dd9a98a2e1085501a476b24556461031 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'contributing.md')
-rw-r--r--contributing.md25
1 files changed, 24 insertions, 1 deletions
diff --git a/contributing.md b/contributing.md
index 06cc7d6..9330ca4 100644
--- a/contributing.md
+++ b/contributing.md
@@ -49,10 +49,33 @@ upstream project. Otherwise, conventions are chosen based on the language.
### Python
Python source should all conform to PEP8. This style is well established
-within the Python community and can be verified with the 'pep8' tool.
+within the Python community and can be verified with the 'pycodestyle' tool.
https://www.python.org/dev/peps/pep-0008/
+### Python Formatting
+
+If a repository has a setup.cfg file present in its root directory,
+then CI will automatically verify the Python code meets the [pycodestyle](http://pycodestyle.pycqa.org/en/latest/intro.html)
+requirements. This enforces PEP 8 standards on all Python code.
+
+OpenBMC standards for Python match with PEP 8 so in general, a blank setup.cfg
+file is all that's needed. If so desired, an enforcement of 80
+(vs. the default 79) chars is fine as well:
+```
+[pycodestyle]
+max-line-length = 80
+```
+By default, pycodestyle does not enforce the following rules: E121, E123, E126,
+E133, E226, E241, E242, E704, W503, and W504. These rules are ignored because
+they are not unanimously accepted and PEP 8 does not enforce them. It is at the
+repository maintainer's discretion as to whether to enforce the aforementioned
+rules. These rules can be enforced by adding the following to the setup.cfg:
+```
+[pycodestyle]
+ignore= NONE
+```
+
### C
For C code, we typically use the Linux coding style, which is documented at:
OpenPOWER on IntegriCloud