Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report failing filenames when --fix=no in mixed-line-endings #341

Merged
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
8 changes: 7 additions & 1 deletion pre_commit_hooks/mixed_line_ending.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ def fix_filename(filename, fix):
# Some amount of mixed line endings
mixed = sum(bool(x) for x in counts.values()) > 1

if fix == 'no' or (fix == 'auto' and not mixed):
if fix == 'no':
if mixed:
# Not fixing, just report problematic file
print('Mixed line endings: {filename}'.format(filename=filename))
return mixed

if fix == 'auto' and not mixed:
return False

asottile marked this conversation as resolved.
Show resolved Hide resolved
if fix == 'auto':
max_ending = LF
max_lines = 0
Expand Down