Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions main/githooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def trim_trailing_whitespace_in_file(filename, new_file, dry_run,
with open(filename, 'rb') as fileobj:
lines = fileobj.read().decode().splitlines(True)
except UnicodeDecodeError:
return
return 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding a test for this case


if new_file:
line_nums = [f'1-{len(lines)}']
Expand All @@ -398,7 +398,7 @@ def trim_trailing_whitespace_in_file(filename, new_file, dry_run,
if dry_run:
modified_lines.append(str(line_num))
else:
print(f' Fixed line {line_num}')
print(f' Fixed line {filename}:{line_num}')
modified_file = True
lines[line_num-1] = after

Expand Down