Skip to content

Commit b85fd64

Browse files
author
Aleck Landgraf
committed
Fixes #293 showing an errant space in the docs with the hang-closing flag.
1 parent b02d768 commit b85fd64

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

docs/intro.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ This is the current list of error and warning codes:
405405
**(*)** In the default configuration, the checks **E121**, **E123**, **E126**,
406406
**E133**, **E226**, **E241**, **E242**, **E704** and **W503** are ignored because
407407
they are not rules unanimously accepted, and `PEP 8`_ does not enforce them. The
408-
check **E133** is mutually exclusive with check **E123**. Use switch ``--hang-
409-
closing`` to report **E133** instead of **E123**.
408+
check **E133** is mutually exclusive with check **E123**. Use switch
409+
``--hang-closing`` to report **E133** instead of **E123**.
410410

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

testsuite/E12.py

+8
Original file line numberDiff line numberDiff line change
@@ -373,4 +373,12 @@ def example_issue254():
373373

374374
print(a
375375
, end=' ')
376+
#: E133:3:1 --hang-closing
377+
a = [
378+
12
379+
]
380+
#: Okay --hang-closing
381+
a = [
382+
12
383+
]
376384
#:

testsuite/support.py

+16
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,19 @@ def init_tests(pep8style):
146146
report = pep8style.init_report(TestReport)
147147
runner = pep8style.input_file
148148

149+
def set_hang_closing_option(pep8style, codes):
150+
"""Set hang-closing option if present in the test codes.
151+
152+
(mutates pep8style)
153+
154+
Usage in test:
155+
#: #E133:3:1 --with-hanging
156+
157+
"""
158+
pep8style.options.hang_closing = '--hang-closing' in codes
159+
codes = [c for c in codes if c != '--hang-closing']
160+
return codes
161+
149162
def run_tests(filename):
150163
"""Run all the tests from a file."""
151164
lines = readlines(filename) + ['#:\n']
@@ -162,6 +175,9 @@ def run_tests(filename):
162175
if codes and index:
163176
if 'noeol' in codes:
164177
testcase[-1] = testcase[-1].rstrip('\n')
178+
179+
codes = set_hang_closing_option(pep8style, codes)
180+
165181
codes = [c for c in codes
166182
if c not in ('Okay', 'noeol')]
167183
# Run the checker

0 commit comments

Comments
 (0)