diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-08-27 13:21:15 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-08-27 13:21:15 -0400 |
commit | 6b4e44011cdeb7159639f2197b62c64c123718ba (patch) | |
tree | bbc90feed9a99601cf74aba1c5dc6010ba3f150c /scripts | |
parent | ca7a80a94646bf62a6af11318d2e02964d778627 (diff) | |
download | kutter-6b4e44011cdeb7159639f2197b62c64c123718ba.tar.gz kutter-6b4e44011cdeb7159639f2197b62c64c123718ba.tar.xz kutter-6b4e44011cdeb7159639f2197b62c64c123718ba.zip |
test: Make white space error report more pronounced
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check_whitespace.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/check_whitespace.py b/scripts/check_whitespace.py index 3ee68693..dd469cba 100755 --- a/scripts/check_whitespace.py +++ b/scripts/check_whitespace.py @@ -10,9 +10,10 @@ HaveError = False def report_error(filename, lineno, msg): global HaveError + if not HaveError: + sys.stderr.write("\n\nERROR:\nERROR: White space errors\nERROR:\n") HaveError = True - sys.stderr.write("Whitespace error in file %s on line %d: %s\n" % ( - filename, lineno + 1, msg)) + sys.stderr.write("%s:%d: %s\n" % (filename, lineno + 1, msg)) def check_file(filename): # Open and read file @@ -32,7 +33,7 @@ def check_file(filename): try: line = line.decode('utf-8') except UnicodeDecodeError: - report_error(filename, lineno, "Non utf-8 character") + report_error(filename, lineno, "Found non utf-8 character") continue # Check for control characters for c in line: @@ -47,7 +48,7 @@ def check_file(filename): break # Check for trailing space if line.endswith(' '): - report_error(filename, lineno, "Trailing space") + report_error(filename, lineno, "Line has trailing spaces") if not data.endswith('\n'): report_error(filename, lineno, "No newline at end of file") if data.endswith('\n\n'): @@ -58,6 +59,7 @@ def main(): for filename in files: check_file(filename) if HaveError: + sys.stderr.write("\n\n") sys.exit(-1) if __name__ == '__main__': |