Add docstring validation

This introduces a linter for PEP257 to avoid trivial nitpicking of
docstrings in code reviews.

Change-Id: I01ebad7b70cf61dd80d3c06c6808d8178fbdd634
Related-Bug: 1501544
Depends-On: I60adf0dca4aa32f4ef6bca61250b375c8a3703c6
This commit is contained in:
Dolph Mathews 2015-10-01 00:13:00 +00:00
parent 9c4ca9a5aa
commit 1bd963be6d
2 changed files with 21 additions and 2 deletions

View File

@ -3,6 +3,8 @@
# process, which may cause wedges in the gate later.
hacking<0.11,>=0.10.0
pep257==0.7.0 # MIT License
flake8_docstrings==0.2.1.post1
bashate>=0.2 # Apache-2.0
# computes code coverage percentages

21
tox.ini
View File

@ -94,8 +94,25 @@ commands = python setup.py testr --slowest --testr-args='{posargs}'
filename= *.py,keystone-all,keystone-manage
show-source = true
# H405 multi line docstring summary not separated with an empty line
ignore = H405
# H405: multi line docstring summary not separated with an empty line
# 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 docstrings should fit on one line with quotes.
# D202: No blank lines allowed after docstring.
# D203: 1 blank required before class docstring.
# D204: 1 blank required after class docstring
# D205: Blank line required between one-line summary and description.
# D208: Docstring over indented.
# D210: No whitespaces allowed surrounding docstring text
# D300: Use """triple double quotes"""
# D400: First line should end with a period.
# D401: First line should be in imperative mood.
# D402: line should not be the function's "signature".
ignore = H405,D100,D101,D102,D103,D104,D105,D200,D202,D203,D204,D205,D208,D210,D300,D400,D401,D402
exclude=.venv,.git,.tox,build,dist,doc,*openstack/common*,*lib/python*,*egg,tools,vendor,.update-venv,*.ini,*.po,*.pot
max-complexity=24