From 831ef5423cc103bb7c825953edbcdef92bc93858 Mon Sep 17 00:00:00 2001 From: Tarek Ziade Date: Fri, 18 Feb 2011 09:05:34 +0100 Subject: [PATCH] fixed pep8 initialization when its run via hg --- flake8/run.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/flake8/run.py b/flake8/run.py index 68682bd..c217324 100644 --- a/flake8/run.py +++ b/flake8/run.py @@ -12,7 +12,6 @@ from flake8 import mccabe def check_file(path, complexity=10): - warnings = pyflakes.checkPath(path) warnings += pep8.input_file(path) warnings += mccabe.get_module_complexity(path, complexity) @@ -64,8 +63,21 @@ def _get_files(repo, **kwargs): yield file_ +class _PEP8Options(object): + exclude = select = [] + show_pep8 = show_source = quiet = verbose = testsuite = False + repeat = True + messages = counters = {} + ignore = pep8.DEFAULT_IGNORE + + def hg_hook(ui, repo, **kwargs): - pep8.process_options() + # default pep8 setup + pep8.options = _PEP8Options() + pep8.options.physical_checks = pep8.find_checks('physical_line') + pep8.options.logical_checks = pep8.find_checks('logical_line') + pep8.args = [] + warnings = 0 for file_ in _get_files(repo, **kwargs): warnings += check_file(file_)