build: specific line with trailing whitespace (#20155)

This commit is contained in:
Shelley Vohr 2019-09-09 06:15:24 -07:00 committed by GitHub
parent d84e2e3972
commit a9f2a52ce0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,10 +46,10 @@ def hasTrailingWhiteSpace(filepath, fix):
f.close()
fixed_lines = []
for line in lines:
for num, line in enumerate(lines):
fixed_lines.append(line.rstrip() + '\n')
if not fix and line != line.rstrip():
print("Trailing whitespace in: " + filepath)
print("Trailing whitespace on line {} in file: {}".format(num + 1, filepath))
return True
if fix:
with open(filepath, 'w') as f: