summaryrefslogtreecommitdiff
path: root/flake8
diff options
context:
space:
mode:
authorIan Cordasco <ian.cordasco@rackspace.com>2015-03-06 19:47:55 -0600
committerIan Cordasco <ian.cordasco@rackspace.com>2015-03-06 19:47:55 -0600
commit54946334db0b72240e17e9bd63354820e6394b3f (patch)
tree6f3ee390313624d1310ee64d6713ee9aff1c7b60 /flake8
parentde9fd7d6a235bd2320b3aec323de783ac97e95c3 (diff)
downloadflake8-mpenkov-master.tar.gz
Diffstat (limited to 'flake8')
-rw-r--r--flake8/hooks.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/flake8/hooks.py b/flake8/hooks.py
index 1a15f0b..773c593 100644
--- a/flake8/hooks.py
+++ b/flake8/hooks.py
@@ -16,11 +16,6 @@ from flake8.engine import get_parser, get_style_guide
from flake8.main import DEFAULT_CONFIG
-def fix_exclude(flake8_style, tmpdir):
- flake8_style.options.exclude = [tmpdir + x if "/" in x else x
- for x in flake8_style.options.exclude]
-
-
def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
"""This is the function used by the git hook.
@@ -57,7 +52,11 @@ def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
flake8_style = get_style_guide(config_file=DEFAULT_CONFIG, paths=['.'],
**options)
- fix_exclude(flake8_style, tmpdir)
+ # Since we use a temporary directory, the exclude path needs to be fixed
+ # to prepend that.
+ path_join = os.path.join
+ flake8_style.options.exclude = [path_join(tmpdir, x) if "/" in x else x
+ for x in flake8_style.options.exclude]
filepatterns = flake8_style.options.filename
# Copy staged versions to temporary directory