Skip to content

Commit 69d88e3

Browse files
nchammasIanLee1521
authored andcommitted
add examples showing StyleGuide config options
1 parent 53a2441 commit 69d88e3

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

docs/advanced.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Advanced usage
88
Automated tests
99
---------------
1010

11-
You can also execute `pep8` tests from Python code. For example, this
11+
You can also execute ``pep8`` tests from Python code. For example, this
1212
can be highly useful for automated testing of coding style conformance
1313
in your project::
1414

@@ -25,7 +25,7 @@ in your project::
2525
self.assertEqual(result.total_errors, 0,
2626
"Found code style errors (and warnings).")
2727

28-
If you are using `nosetests` for running tests, remove `quiet=True`
28+
If you are using ``nosetests`` for running tests, remove ``quiet=True``
2929
since Nose suppresses stdout.
3030

3131
There's also a shortcut for checking a single file::
@@ -38,6 +38,23 @@ There's also a shortcut for checking a single file::
3838
print("Found %s errors (and warnings)" % file_errors)
3939

4040

41+
Configuring tests
42+
.................
43+
44+
You can configure automated ``pep8`` tests in a variety of ways.
45+
46+
For example, you can pass in a path to a configuration file that ``pep8``
47+
should use::
48+
49+
import pep8
50+
51+
pep8style = pep8.StyleGuide(config_file='/path/to/tox.ini')
52+
53+
You can also set specific options explicitly::
54+
55+
pep8style = pep8.StyleGuide(ignore=['E501'])
56+
57+
4158
Skip file header
4259
----------------
4360

@@ -46,7 +63,6 @@ Another example is related to the `feature request #143
4663
at the beginning and the end of a file. This use case is easy to implement
4764
through a custom wrapper for the PEP 8 library::
4865

49-
#!python
5066
import pep8
5167

5268
LINES_SLICE = slice(14, -20)

0 commit comments

Comments
 (0)