mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 18:56:53 +00:00
parent
8eec1e5e11
commit
e236b7f6b3
2 changed files with 6 additions and 4 deletions
|
|
@ -35,8 +35,9 @@ def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
|
|||
|
||||
def hg_hook(ui, repo, **kwargs):
|
||||
from flake8.main import check_file
|
||||
_initpep8()
|
||||
complexity = ui.config('flake8', 'complexity', default=-1)
|
||||
config = ui.config('flake8', 'config', default=True)
|
||||
_initpep8(config_file=config)
|
||||
warnings = 0
|
||||
|
||||
for file_ in _get_files(repo, **kwargs):
|
||||
|
|
|
|||
|
|
@ -91,16 +91,17 @@ def skip_file(path, source=None):
|
|||
return _NOQA.search(content) is not None
|
||||
|
||||
|
||||
def _initpep8():
|
||||
def _initpep8(config_file=True):
|
||||
# default pep8 setup
|
||||
global pep8style
|
||||
import pep8
|
||||
if pep8style is None:
|
||||
pep8style = pep8.StyleGuide(config_file=True)
|
||||
pep8style = pep8.StyleGuide(config_file=config_file)
|
||||
pep8style.options.physical_checks = pep8.find_checks('physical_line')
|
||||
pep8style.options.logical_checks = pep8.find_checks('logical_line')
|
||||
pep8style.options.counters = dict.fromkeys(pep8.BENCHMARK_KEYS, 0)
|
||||
pep8style.options.messages = {}
|
||||
pep8style.options.max_line_length = 79
|
||||
if not pep8style.options.max_line_length:
|
||||
pep8style.options.max_line_length = 79
|
||||
pep8style.args = []
|
||||
return pep8style
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue