@@ -10,149 +10,30 @@ custom checks can be easily added, for example to cover
1010NumPy `docstring conventions
1111<https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt> `_.
1212
13- Installation
14- -----------------------------------------------------------
13+ **pep257 ** supports Python 2.6, 2.7, 3.2, 3.3, 3.4, pypy and pypy3.
1514
16- Use `pip <http://pip-installer.org >`_ or easy_install::
15+ Quick Start
16+ -----------
1717
18- pip install pep257
18+ Install
19+ ^^^^^^^
1920
20- Alternatively, you can use ``pep257.py `` source file
21- directly--it is self-contained.
21+ .. code ::
2222
23- ** pep257 ** is tested with Python 2.6, 2.7, 3.2, 3.3, 3.4, pypy and pypy3.
23+ pip install pep257
2424
25- Example
26- -----------------------------------------------------------
25+ Run
26+ ^^^
2727
2828.. code ::
2929
30- $ pep257 --help
31- Usage: pep257 [options] [<file|dir>...]
32-
33- Options:
34- --version show program's version number and exit
35- -h, --help show this help message and exit
36- -e, --explain show explanation of each error
37- -s, --source show source for each error
38- --ignore=<codes> ignore a list comma-separated error codes, for
39- example: --ignore=D101,D202
40- --match=<pattern> check only files that exactly match <pattern> regular
41- expression; default is --match='(?!test_).*\.py' which
42- matches files that don't start with 'test_' but end
43- with '.py'
44- --match-dir=<pattern>
45- search only dirs that exactly match <pattern> regular
46- expression; default is --match-dir='[^\.].*', which
47- matches all dirs that don't start with a dot
48- -d, --debug print debug information
49- -v, --verbose print status information
50- --count print total number of errors to stdout
51-
5230 $ pep257 test.py
5331 test.py:18 in private nested class `meta`:
5432 D101: Docstring missing
5533 test.py:22 in public method `method`:
5634 D102: Docstring missing
5735 ...
5836
59- $ pep257 test.py --explain
60- test.py:18 in private nested class `meta`:
61- D101: Docstring missing
62-
63- All modules should normally have docstrings. [...] all functions and
64- classes exported by a module should also have docstrings. Public
65- methods (including the __init__ constructor) should also have
66- docstrings.
67-
68- Note: Public (exported) definitions are either those with names listed
69- in __all__ variable (if present), or those that do not start
70- with a single underscore.
71- ...
72-
73- $ pep257 test.py --source
74- test.py:15 in public class `class_`:
75- D101: Docstring missing
76-
77- 15: class class_:
78- 16:
79- ...
80-
81- $ pep257 test.py --count
82- test.py:18 in private nested class `meta`:
83- D101: Docstring missing
84- test.py:22 in public method `method`:
85- D102: Docstring missing
86- ...
87- 33
88-
89-
90- Error codes
91- -----------------------------------------------------------
92-
93- All **pep257 ** errors have unique codes. All codes start with a capital D and
94- are grouped as follows:
95-
96- +--------------+--------------------------------------------------------------+
97- | **Missing docstrings ** |
98- +--------------+--------------------------------------------------------------+
99- | D10{0,1,2,3} | Public {module,class,method,function} missing. |
100- +--------------+--------------------------------------------------------------+
101- | **Whitespace issues ** |
102- +--------------+--------------------------------------------------------------+
103- | D200 | One-line docstrings should fit on one line with quotes. |
104- +--------------+--------------------------------------------------------------+
105- | D20{1,2} | No blank lines allowed {before,after} docstring. |
106- +--------------+--------------------------------------------------------------+
107- | D20{3,4} | 1 blank required {before,after} class docstring. |
108- +--------------+--------------------------------------------------------------+
109- | D205 | Blank line required between one-line summary and description.|
110- +--------------+--------------------------------------------------------------+
111- | D206 | Docstring should be indented with spaces, not tabs. |
112- +--------------+--------------------------------------------------------------+
113- | D20{7,8} | Docstring {under,over}-indented. |
114- +--------------+--------------------------------------------------------------+
115- | D209 | Put multi-line docstring closing quotes on separate line. |
116- +--------------+--------------------------------------------------------------+
117- | D210 | No whitespaces allowed surrounding docstring text. |
118- +--------------+--------------------------------------------------------------+
119- | **Quotes issues ** |
120- +--------------+--------------------------------------------------------------+
121- | D300 | Use """triple double quotes""". |
122- +--------------+--------------------------------------------------------------+
123- | D301 | Use r""" if any backslashes in your docstring. |
124- +--------------+--------------------------------------------------------------+
125- | D302 | Use u""" for Unicode docstrings (Python 2 only). |
126- +--------------+--------------------------------------------------------------+
127- | **Docstring content issues ** |
128- +--------------+--------------------------------------------------------------+
129- | D400 | First line should end with a period. |
130- +--------------+--------------------------------------------------------------+
131- | D401 | First line should be in imperative mood. |
132- +--------------+--------------------------------------------------------------+
133- | D402 | First line should not be the function's "signature". |
134- +--------------+--------------------------------------------------------------+
135-
136- Configuration
137- -----------------------------------------------------------
138- ``pep257 `` looks for a config file in the root of the project (the common
139- prefix of all checked files) and goes up in the directory tree until it finds
140- one of the following files (in this order):
141-
142- * ``setup.cfg ``
143- * ``tox.ini ``
144- * ``.pep257 ``
145-
146- The first found file is read, and configurations in the ``[pep257] `` section
147- are used, if such a section exists.
148-
149- Config Example
150- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
151-
152- .. code ::
15337
154- [pep257]
155- verbose = true
156- ignore = D100,D203,D405
157- explain = true
38+ `Read the full documentation here <http://pep257.readthedocs.org >`_.
15839
0 commit comments