Skip to content

Commit 763cb72

Browse files
committed
Accept both styles of closing bracket indentation, ignore E123 in the default configuration
1 parent a1d2db6 commit 763cb72

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

CHANGES.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ Changelog
1717

1818
* Correctly report other E12 errors when E123 is ignored. (Issue #103)
1919

20-
* New option `--hang-closing` to switch to the alternative style of
20+
* New option ``--hang-closing`` to switch to the alternative style of
2121
closing bracket indentation for hanging indent. Add error E133 for
2222
closing bracket which is missing indentation. (Issue #103)
2323

24+
* Accept both styles of closing bracket indentation for hanging indent.
25+
Do not report error E123 in the default configuration. (Issue #103)
26+
2427
* Do not crash when running AST checks and the document contains null bytes.
2528
(Issue #184)
2629

docs/intro.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ Quick help is available on the command line::
134134
--count print total number of errors and warnings to standard
135135
error and set exit code to 1 if total is not null
136136
--max-line-length=n set maximum allowed line length (default: 79)
137+
--hang-closing hang closing bracket instead of matching indentation of
138+
opening bracket's line
137139
--format=format set the error format [default|pylint|<custom>]
138140
--diff report only lines changed according to the unified diff
139141
received on STDIN
@@ -145,8 +147,8 @@ Quick help is available on the command line::
145147
The project options are read from the [pep8] section of the tox.ini
146148
file or the setup.cfg file located in any parent folder of the path(s)
147149
being processed. Allowed options are: exclude, filename, select,
148-
ignore, max-line-length, count, format, quiet, show-pep8, show-source,
149-
statistics, verbose.
150+
ignore, max-line-length, hang-closing, count, format, quiet, show-pep8,
151+
show-source, statistics, verbose.
150152

151153
--config=path user config file location (default: ~/.config/pep8)
152154

@@ -195,7 +197,7 @@ This is the current list of error and warning codes:
195197
+----------+----------------------------------------------------------------------+
196198
| E122 (^) | continuation line missing indentation or outdented |
197199
+----------+----------------------------------------------------------------------+
198-
| E123 (^) | closing bracket does not match indentation of opening bracket's line |
200+
| E123 (*) | closing bracket does not match indentation of opening bracket's line |
199201
+----------+----------------------------------------------------------------------+
200202
| E124 (^) | closing bracket does not match visual indentation |
201203
+----------+----------------------------------------------------------------------+
@@ -207,6 +209,7 @@ This is the current list of error and warning codes:
207209
+----------+----------------------------------------------------------------------+
208210
| E128 (^) | continuation line under-indented for visual indent |
209211
+----------+----------------------------------------------------------------------+
212+
| E133 (*) | closing bracket is missing indentation |
210213
+----------+----------------------------------------------------------------------+
211214
| **E2** | *Whitespace* |
212215
+----------+----------------------------------------------------------------------+
@@ -337,9 +340,11 @@ This is the current list of error and warning codes:
337340
| W604 | backticks are deprecated, use 'repr()' |
338341
+----------+----------------------------------------------------------------------+
339342

340-
**(*)** In the default configuration, the checks **E226**, **E241**
341-
and **E242** are ignored because they are not rules unanimously accepted,
342-
and `PEP 8`_ does not enforce them.
343+
**(*)** In the default configuration, the checks **E123**, **E133**, **E226**,
344+
**E241** and **E242** are ignored because they are not rules unanimously
345+
accepted, and `PEP 8`_ does not enforce them. The check **E133** is mutually
346+
exclusive with check **E123**. Use switch ``--hang-closing`` to report **E133**
347+
instead of **E123**.
343348

344349
**(^)** These checks can be disabled at the line level using the ``# noqa``
345350
special comment. This possibility should be reserved for special cases.

pep8.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
from ConfigParser import RawConfigParser
6464

6565
DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__'
66-
DEFAULT_IGNORE = 'E226,E24'
66+
DEFAULT_IGNORE = 'E123,E226,E24'
6767
if sys.platform == 'win32':
6868
DEFAULT_CONFIG = os.path.expanduser(r'~\.pep8')
6969
else:

0 commit comments

Comments
 (0)