@@ -18,12 +18,14 @@ def test_trailing_white_spaces():
18
18
for file_path in py_files :
19
19
file = open (file_path , "r" )
20
20
line = file .readline ()
21
+ line_number = 1
21
22
while line != "" :
22
23
if line .endswith (" \n " ) or line .endswith ("\t \n " ) \
23
24
or line .endswith (" " ) or line .endswith ("\t " ):
24
- assert False , "%s contains trailing whitespace at %s" \
25
- % (file_path , line )
25
+ assert False , "%s contains trailing whitespace at line number %d: %s" \
26
+ % (file_path , line_number , line )
26
27
line = file .readline ()
28
+ line_number += 1
27
29
file .close ()
28
30
29
31
def test_final_new_lines ():
@@ -46,6 +48,7 @@ def test_comparison_True_False_None():
46
48
if file_path .find ("test_code_quality.py" ) == - 1 :
47
49
file = open (file_path , "r" )
48
50
line = file .readline ()
51
+ line_number = 1
49
52
while line != "" :
50
53
if ((line .find ("== True" ) != - 1 ) or
51
54
(line .find ("== False" ) != - 1 ) or
@@ -54,9 +57,10 @@ def test_comparison_True_False_None():
54
57
(line .find ("!= False" ) != - 1 ) or
55
58
(line .find ("!= None" ) != - 1 )):
56
59
assert False , "%s compares True/False/None using by " \
57
- "value, should be done by reference at %s" \
58
- % (file_path , line )
60
+ "value, should be done by reference at line number %d: %s" \
61
+ % (file_path , line_number , line )
59
62
line = file .readline ()
63
+ line_number += 1
60
64
file .close ()
61
65
62
66
def test_presence_of_tabs ():
0 commit comments