mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 04:56:54 +00:00
Fix #21. `init` can also be used elsewhere.
Sane defaults are awesome. Also, I hope mercurial uses similar commit messages to git. ;)
This commit is contained in:
parent
d126c3503e
commit
a4ebc1c5c4
1 changed files with 9 additions and 7 deletions
|
|
@ -54,9 +54,14 @@ def _get_python_files(paths):
|
|||
yield path
|
||||
|
||||
|
||||
def main():
|
||||
def init(parse_argv=False, config_file=True, **kwargs):
|
||||
global pep8style
|
||||
pep8style = pep8.StyleGuide(parse_argv=True, config_file=True)
|
||||
pep8style = pep8.StyleGuide(parse_argv=parse_argv,
|
||||
config_file=config_file)
|
||||
|
||||
|
||||
def main():
|
||||
init(True)
|
||||
options = pep8style.options
|
||||
complexity = options.max_complexity
|
||||
builtins = set(options.builtins)
|
||||
|
|
@ -138,9 +143,7 @@ def run(command):
|
|||
|
||||
|
||||
def git_hook(complexity=-1, strict=False, ignore=None):
|
||||
global pep8style
|
||||
pep8style = pep8.StyleGuide(config_file=True)
|
||||
|
||||
init()
|
||||
_initpep8()
|
||||
if ignore:
|
||||
pep8.options.ignore = ignore
|
||||
|
|
@ -203,8 +206,7 @@ else:
|
|||
yield "%s.py" % filename
|
||||
|
||||
def run(self):
|
||||
global pep8style
|
||||
pep8style = pep8.StyleGuide(config_file=True)
|
||||
init()
|
||||
|
||||
_initpep8()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue