File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,13 @@ def check_line_endings(filename, print_errors=True):
13
13
if print_errors : print >> sys .stderr , "Unable to read file '" + filename + "', or file was empty!"
14
14
return 1
15
15
16
- if "\r \r \n " in data :
17
- if print_errors : print >> sys .stderr , "File '" + filename + "' contains BAD line endings of form \\ r\\ r\\ n!"
16
+ bad_line_ending_index = data .find ("\r \r \n " )
17
+ if bad_line_ending_index != - 1 :
18
+ if print_errors :
19
+ print >> sys .stderr , "File '" + filename + "' contains BAD line endings of form \\ r\\ r\\ n!"
20
+ bad_line = data [max (0 ,bad_line_ending_index - 50 ):min (len (data ), bad_line_ending_index + 50 )]
21
+ bad_line = bad_line .replace ('\r ' , '\\ r' ).replace ('\n ' , '\\ n' )
22
+ print >> sys .stderr , "Content around the location: '" + bad_line + "'"
18
23
return 1 # Bad line endings in file, return a non-zero process exit code.
19
24
20
25
has_dos_line_endings = False
You can’t perform that action at this time.
0 commit comments