PEP257: add flake8-docstring testing

PEP257 (https://www.python.org/dev/peps/pep-0257/) aims to "standardize
the high-level structure of docstrings: what they should contain, and
how to say it (without touching on any markup syntax within docstrings).
The PEP contains conventions, not laws or syntax."

By having this flake8 extension installed as we do in other keystone
repositories, keystonemiddleware will be automatically gated against
PEP257 docstring conventions. Of course, we're also violating several
conventions here, all of which must be ignored to get the pep8 tox job
passing.

By fixing violations one at a time, we can then remove the ignore lines
in subsequent patches.

Change-Id: Icb329b7fb42172245a635d7c089858d66a6a19da
This commit is contained in:
Dolph Mathews 2016-04-13 01:14:44 +00:00
parent 5e17a784be
commit 45a0d08532
2 changed files with 16 additions and 6 deletions

View File

@ -3,6 +3,7 @@
# process, which may cause wedges in the gate later.
hacking<0.11,>=0.10.0
flake8-docstrings==0.2.1.post1 # MIT
coverage>=3.6 # Apache-2.0
fixtures<2.0,>=1.3.1 # Apache-2.0/BSD

21
tox.ini
View File

@ -35,12 +35,21 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
commands = oslo_debug_helper {posargs}
[flake8]
# NOTE(lbragstad): Even though we aren't ignoring any hacking checks, we have
# to leave it assigned in the environment specification otherwise some error
# checks will be ignored by default. If we need to ignore a specific hacking
# check in the future, we will have to remove '___' from the ignore line.
# See: http://flake8.readthedocs.org/en/latest/config.html#default
ignore = ___
# D100: Missing docstring in public module
# D101: Missing docstring in public class
# D102: Missing docstring in public method
# D103: Missing docstring in public function
# D104: Missing docstring in public package
# D105: Missing docstring in magic method
# D200: One-line docstring should fit on one line with quotes
# D202: No blank lines allowed after function docstring
# D204: 1 blank line required after class docstring
# D209: Multi-line docstring closing quotes should be on a separate line
# D301: Use r""" if any backslashes in a docstring
# D400: First line should end with a period
# D401: First line should be in imperative mood
# H403: multi line docstrings should end on a new line
ignore = D100,D101,D102,D103,D104,D105,D200,D202,D209,D301,D204,D400,D401,H403
show-source = True
exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*