13
13
:alt: GitHub last commit
14
14
15
15
====
16
- Doc8
16
+ doc8
17
17
====
18
18
19
- Doc8 is an *opinionated * style checker for ` rst `_ (with basic support for
19
+ * doc8 * is an *opinionated * style checker for rst __ (with basic support for
20
20
plain text) styles of documentation.
21
21
22
- QuickStart
23
- ==========
22
+ __ http://docutils.sourceforge.net/docs/ref/rst/introduction.html
23
+
24
+ Quick start
25
+ -----------
24
26
25
27
::
26
28
27
29
pip install doc8
28
30
29
- To run doc8 just invoke it against any doc directory::
31
+ To run * doc8 *, just invoke it against any documentation directory::
30
32
31
33
$ doc8 cool-project/docs
32
34
33
35
Usage
34
- =====
35
-
36
- Command line usage
37
- ******************
36
+ -----
38
37
39
38
::
40
39
@@ -91,8 +90,8 @@ Command line usage
91
90
-v, --verbose run in verbose mode.
92
91
--version show the version and exit.
93
92
94
- Ini file usage
95
- **************
93
+ INI file usage
94
+ ~~~~~~~~~~~~~~
96
95
97
96
Instead of using the CLI for options the following files will also be examined
98
97
for ``[doc8] `` sections that can also provide the same set of options. If
@@ -118,35 +117,11 @@ An example section that can be placed into one of these files::
118
117
only variation of this being the ``no-sphinx `` option which from the
119
118
configuration file will be ``sphinx `` instead).
120
119
121
- Python Usage
122
- ************
123
-
124
- To call doc8 from a Python project do::
125
-
126
- from doc8 import doc8
127
-
128
- result = doc8(allow_long_titles=True, max_line_length=99)
129
-
130
- The returned ``result `` will have the following attributes and methods:
131
-
132
- * ``result.files_selected `` - number of files selected
133
- * ``result.files_ignored `` - number of files ignored
134
- * ``result.error_counts `` - ``dict `` of ``{check_name: error_count} ``
135
- * ``result.total_errors `` - total number of errors found
136
- * ``result.errors `` - list of
137
- ``(check_name, filename, line_num, code, message) `` tuples
138
- * ``result.report() `` - returns a human-readable report as a string
139
-
140
- Note that calling ``doc8 `` in this way will not write to stdout, so the
141
- ``quiet `` and ``verbose `` options are ignored.
142
-
143
-
144
120
Option conflict resolution
145
- **************************
121
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
146
122
147
123
When the same option is passed on the command line and also via configuration
148
- files the following strategies are applied to resolve these types
149
- of conflicts.
124
+ files the following strategies are applied to resolve these types of conflicts.
150
125
151
126
====================== =========== ========
152
127
Option Overrides Merges
@@ -169,4 +144,29 @@ option (for example by becoming a larger list or set of values that contains
169
144
the values passed on the command line *and * the values passed via
170
145
configuration).
171
146
172
- .. _rst : http://docutils.sourceforge.net/docs/ref/rst/introduction.html
147
+
148
+ API
149
+ ---
150
+
151
+ It is also possible to use *doc8 * programmatically. To call *doc8 * from a
152
+ Python project, use::
153
+
154
+ from doc8 import doc8
155
+
156
+ result = doc8(allow_long_titles=True, max_line_length=99)
157
+
158
+ The returned ``result `` will have the following attributes and methods:
159
+
160
+ * ``result.files_selected `` - number of files selected
161
+ * ``result.files_ignored `` - number of files ignored
162
+ * ``result.error_counts `` - ``dict `` of ``{check_name: error_count} ``
163
+ * ``result.total_errors `` - total number of errors found
164
+ * ``result.errors `` - list of
165
+ ``(check_name, filename, line_num, code, message) `` tuples
166
+ * ``result.report() `` - returns a human-readable report as a string
167
+
168
+ The ``doc8 `` method accepts the same arguments as the executable. Simply
169
+ replace hyphens with underscores.
170
+
171
+ **Note: ** Calling ``doc8 `` in this way will not write to stdout, so the
172
+ ``quiet `` and ``verbose `` options are ignored.
0 commit comments