diff options
| author | Ian Stapleton Cordasco <graffatcolmingov@gmail.com> | 2018-01-01 00:53:56 +0000 |
|---|---|---|
| committer | Ian Stapleton Cordasco <graffatcolmingov@gmail.com> | 2018-01-01 00:53:56 +0000 |
| commit | 0c7de6df55ee36cf6b40ef5f2b4c346dd68ee605 (patch) | |
| tree | 796c728716298e6a1082e3dc803a6d82c8923d6f | |
| parent | f0d63a5a998011d95eaa31c994a295a085bd8000 (diff) | |
| parent | 9d2ff76d312873ddf1bc19b20bff3d94d3cfda50 (diff) | |
| download | flake8-0c7de6df55ee36cf6b40ef5f2b4c346dd68ee605.tar.gz | |
Merge branch 'isort-fix' into 'master'
fix for flake8-isort
See merge request pycqa/flake8!215
| -rw-r--r-- | src/flake8/main/git.py | 18 |
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() |
