summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomer Chachamu <tomer@festicket.com>2017-11-24 13:08:47 +0000
committerTomer Chachamu <tomer@festicket.com>2017-11-27 11:10:41 +0000
commit9d2ff76d312873ddf1bc19b20bff3d94d3cfda50 (patch)
tree72153473a58df3f791243cf1f027449ac43c1c8c
parent3530870679ddb93ade9326d9e5d932596b66e8b9 (diff)
downloadflake8-9d2ff76d312873ddf1bc19b20bff3d94d3cfda50.tar.gz
fix for flake8-isort
-rw-r--r--src/flake8/main/git.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/flake8/main/git.py b/src/flake8/main/git.py
index ad55100..3637feb 100644
--- a/src/flake8/main/git.py
+++ b/src/flake8/main/git.py
@@ -132,6 +132,12 @@ def find_git_directory():
def copy_indexed_files_to(temporary_directory, lazy):
+ # some plugins (e.g. flake8-isort) need these files to run their checks
+ setup_cfgs = find_setup_cfgs(lazy)
+ for filename in setup_cfgs:
+ contents = get_staged_contents_from(filename)
+ copy_file_to(temporary_directory, filename, contents)
+
modified_files = find_modified_files(lazy)
for filename in modified_files:
contents = get_staged_contents_from(filename)
@@ -170,6 +176,18 @@ def find_modified_files(lazy):
return stdout.splitlines()
+def find_setup_cfgs(lazy):
+ setup_cfg_cmd = [
+ 'git', 'ls-files', '--cached', '*setup.cfg'
+ ]
+ if lazy:
+ setup_cfg_cmd.remove('--cached')
+ extra_files = piped_process(setup_cfg_cmd)
+ (stdout, _) = extra_files.communicate()
+ stdout = to_text(stdout)
+ return stdout.splitlines()
+
+
def get_staged_contents_from(filename):
git_show = piped_process(['git', 'show', ':{0}'.format(filename)])
(stdout, _) = git_show.communicate()