File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -18,19 +18,20 @@ def report_err(s):
18
18
print ("%s:%d: %s" % (fileinput .filename (), fileinput .filelineno (), s ))
19
19
err = 1
20
20
21
- for line in fileinput .input (openhook = fileinput .hook_encoded ("utf-8" )):
22
- if line .find ('\t ' ) != - 1 and fileinput .filename ().find ("Makefile" ) == - 1 :
23
- report_err ("tab character" )
24
-
25
- if not autocrlf and line .find ('\r ' ) != - 1 :
26
- report_err ("CR character" )
27
-
28
- if line .endswith (" \n " ) or line .endswith ("\t \n " ):
29
- report_err ("trailing whitespace" )
30
-
31
- line_len = len (line )- 2 if autocrlf else len (line )- 1
32
- if line_len > cols :
33
- report_err ("line longer than %d chars" % cols )
21
+ try :
22
+ for line in fileinput .input (openhook = fileinput .hook_encoded ("utf-8" )):
23
+ if (line .find ('\t ' ) != - 1 and
24
+ fileinput .filename ().find ("Makefile" ) == - 1 ):
25
+ report_err ("tab character" )
26
+ if not autocrlf and line .find ('\r ' ) != - 1 :
27
+ report_err ("CR character" )
28
+ if line .endswith (" \n " ) or line .endswith ("\t \n " ):
29
+ report_err ("trailing whitespace" )
30
+ line_len = len (line )- 2 if autocrlf else len (line )- 1
31
+ if line_len > cols :
32
+ report_err ("line longer than %d chars" % cols )
33
+ except UnicodeDecodeError , e :
34
+ report_err ("UTF-8 decoding error " + str (e ))
34
35
35
36
36
37
sys .exit (err )
You can’t perform that action at this time.
0 commit comments