Skip to content

Commit

Permalink
Read pep8 conf. files from parent directories.
Browse files Browse the repository at this point in the history
Fixed bug where pep8 configuration file was only read on the current
directory, instead of searching also parent directories.

Related to issue #3.
  • Loading branch information
nfvs committed May 8, 2014
1 parent f44f8a2 commit e57b1f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def check(self, code, filename):
# `onError` will be called by `process_options` when no pep8 configuration file is found.
# Override needed to supress OptionParser.error() output in the default parser.
def onError(msg):
raise SystemExit
pass

from pep8 import process_options, get_parser
parser = get_parser()
parser.error = onError
pep8_options, _ = process_options([], True, True, parser=parser)
pep8_options, _ = process_options([os.curdir], True, True, parser=parser)
pep8_options = vars(pep8_options)
del pep8_options['reporter']
pep8_options.pop('reporter', None)
for opt_n, opt_v in pep8_options.items():
if isinstance(final_options.get(opt_n, None), list):
final_options[opt_n] += opt_v
Expand Down

0 comments on commit e57b1f1

Please sign in to comment.