mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 10:46:54 +00:00
fix for flake8-isort
This commit is contained in:
parent
3530870679
commit
9d2ff76d31
1 changed files with 18 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue