summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Rathgeber <florian.rathgeber@gmail.com>2014-03-23 18:52:00 +0000
committerFlorian Rathgeber <florian.rathgeber@gmail.com>2014-03-23 18:52:00 +0000
commitb0499123171ade5c472fba46ee711411f1d5fa2c (patch)
treee13cab812f27a277282bedfb9ac6039d47afbec0
parent39e60d42544a75589b05fdb5855a03f0e073de08 (diff)
downloadflake8-b0499123171ade5c472fba46ee711411f1d5fa2c.tar.gz
Pass current directory as paths to pep8 StyleGuide
Instead of setting parse_argv to True, which fails if no config files are present, we pass the current directory as the paths keyword argument when creating the pep8 StyleGuide. This causes pep8 to parse local config files as expected and works also if none are present. Requires pep8 68d72a5d or newer.
-rw-r--r--flake8/hooks.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/flake8/hooks.py b/flake8/hooks.py
index 3249dcf..403dcf9 100644
--- a/flake8/hooks.py
+++ b/flake8/hooks.py
@@ -55,11 +55,8 @@ def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
files_modified = [f for f in files_modified if f.endswith('.py')]
- flake8_style = get_style_guide(
- parse_argv=True,
- config_file=DEFAULT_CONFIG,
- **options
- )
+ flake8_style = get_style_guide(config_file=DEFAULT_CONFIG, paths=['.'],
+ **options)
# Copy staged versions to temporary directory
tmpdir = mkdtemp()
@@ -117,7 +114,7 @@ def hg_hook(ui, repo, **kwargs):
if complexity > -1:
options['max_complexity'] = complexity
- flake8_style = get_style_guide(parse_argv=True, config_file=config,
+ flake8_style = get_style_guide(config_file=config, paths=['.'],
**options)
report = flake8_style.check_files(paths)