If you are familiar with PEP8 and its official checker pep8, then doc8 is something you might like as well. I was thinking it should be called rst8, but then I recall reStructuredText is done by docutils library, so doc8 makes sense.
Here is an example output on one of my project:
$ doc8 docs/ docs/usage.rst:86: D002 Trailing whitespace docs/introduction.rst:23: D001 Line too long docs/_build/html/_sources/introduction.txt:23: D001 Line too long docs/_build/html/_sources/usage.txt:86: D002 Trailing whitespace
Ah ha! Pesky trailing whitespaces are caught. I don’t know you, but I don’t like those useless whitespaces hanging around. doc8 definitely is a keeper for me, don’t know the programmical incorporation yet, but it would worth adding it to tests for automatic checks.
It currently has four checks: D0001 to D004:
- D001
- lines should not be longer than 79 characters, plus some exceptions
- D002
- no trailing whitespace
- D003
- no tabulation for indentation
- D004
- no carriage returns (use unix newlines)
Like pep8, you can disable any checks you don’t like with --ignore, --allow-long-titles and --max-line-length would make the lengths more flexible or sensible.
doc8 is written by Joshua Harlow under the Apache License Version 2.0, currently version 0.3.3 (2014-05-19), for both Python 2 and 3.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.