Make check-whitespace.py exit 1 on whitespace errors

This commit is contained in:
Éric Lemoine
2015-04-29 09:12:13 +02:00
parent 6d1baec34a
commit b4434725a5

View File

@@ -37,8 +37,10 @@ def check_whitespace(*filenames):
if whitespace:
logger.info('%s: trailing whitespace at end of file', filename)
errors += 1
if errors:
logger.error('%d whitespace errors' % (errors,))
return errors
if __name__ == "__main__":
check_whitespace(*sys.argv[1:])
errors = check_whitespace(*sys.argv[1:])
if errors > 0:
logger.error('%d whitespace errors' % (errors,))
sys.exit(1)