--modified-only flag walks over all file types in diff
Closed this issue · 2 comments
fergusleahytab commented
Noticed that when specifying the --modified-only flag, bellybutton no longer filters for only '.py' files, which causes it to try and parse unwanted files.
fergusleahytab commented
Could be as simple as adding if os.path.splitext(path)[1] == '.py'
to the get_git_modified
.
def get_git_modified(project_directory):
"""Get all modified filepaths between current ref and origin/master."""
subprocess.check_call(
'git -C "{}" fetch origin'.format(project_directory),
shell=True
)
diff_cmd = 'git -C "{}" diff {{}} --name-only'.format(os.path.abspath(project_directory))
return frozenset(
os.path.abspath(path)
for diff in ('--staged', 'origin/master...')
for path in subprocess.check_output(
diff_cmd.format(diff),
shell=True
).decode('utf-8').strip().splitlines()
if os.path.splitext(path)[1] == '.py'
)
hchasestevens commented
Hi @fergusleahytab , thanks for raising this. This should be resolved in version 0.3.0.