Skip to content

Commit dc7adfc

Browse files
committed
Fix behavior when 'select' is passed to the StyleGuide constructor
1 parent e294d24 commit dc7adfc

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Changelog
2323
* Reorganize the tests and add tests for the API and for the command line
2424
usage and options. (Issues #161 and #162)
2525

26+
* Ignore all checks which are not explicitly selected when ``select`` is
27+
passed to the ``StyleGuide`` constructor.
28+
2629

2730
1.4.4 (2013-02-24)
2831
------------------

pep8.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,9 +1574,14 @@ def __init__(self, *args, **kwargs):
15741574

15751575
for index, value in enumerate(options.exclude):
15761576
options.exclude[index] = value.rstrip('/')
1577-
# Ignore all checks which are not explicitly selected
15781577
options.select = tuple(options.select or ())
1579-
options.ignore = tuple(options.ignore or options.select and ('',))
1578+
if not (options.select or options.ignore or
1579+
options.testsuite or options.doctest) and DEFAULT_IGNORE:
1580+
# The default choice: ignore controversial checks
1581+
options.ignore = tuple(DEFAULT_IGNORE.split(','))
1582+
else:
1583+
# Ignore all checks which are not explicitly selected
1584+
options.ignore = tuple(options.ignore or options.select and ('',))
15801585
options.benchmark_keys = BENCHMARK_KEYS[:]
15811586
options.ignore_code = self.ignore_code
15821587
options.physical_checks = self.get_checks('physical_line')
@@ -1824,11 +1829,6 @@ def process_options(arglist=None, parse_argv=False, config_file=None,
18241829
options.select = options.select.split(',')
18251830
if options.ignore:
18261831
options.ignore = options.ignore.split(',')
1827-
elif not (options.select or
1828-
options.testsuite or options.doctest) and DEFAULT_IGNORE:
1829-
# The default choice: ignore controversial checks
1830-
# (for doctest and testsuite, all checks are required)
1831-
options.ignore = DEFAULT_IGNORE.split(',')
18321832

18331833
if options.diff:
18341834
options.reporter = DiffReport

0 commit comments

Comments
 (0)