mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 12:06:53 +00:00
Report failing filenames when --fix=no in mixed-line-endings
This commit is contained in:
parent
2dbaced650
commit
f3c65bcd20
1 changed files with 7 additions and 1 deletions
|
|
@ -37,9 +37,15 @@ def fix_filename(filename, fix):
|
||||||
# Some amount of mixed line endings
|
# Some amount of mixed line endings
|
||||||
mixed = sum(bool(x) for x in counts.values()) > 1
|
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
|
return mixed
|
||||||
|
|
||||||
|
if fix == 'auto' and not mixed:
|
||||||
|
return False
|
||||||
|
|
||||||
if fix == 'auto':
|
if fix == 'auto':
|
||||||
max_ending = LF
|
max_ending = LF
|
||||||
max_lines = 0
|
max_lines = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue