mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-29 10:36:53 +00:00
fixed pep8 initialization when its run via hg
This commit is contained in:
parent
12ee40f481
commit
831ef5423c
1 changed files with 14 additions and 2 deletions
|
|
@ -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_)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue