diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-02-27 14:19:15 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-02-27 14:33:17 -0500 |
commit | 5dc487faf98468e3b35cf9e58ad09aafdaadb1f7 (patch) | |
tree | 1c18009e0ba161478dcd990971af7abf3be1f1e0 /scripts | |
parent | 1b064b5a5d39550e9550e364106b7fb946baf3c8 (diff) | |
download | kutter-5dc487faf98468e3b35cf9e58ad09aafdaadb1f7.tar.gz kutter-5dc487faf98468e3b35cf9e58ad09aafdaadb1f7.tar.xz kutter-5dc487faf98468e3b35cf9e58ad09aafdaadb1f7.zip |
check_whitespace: Enforce an 80 column limit on source code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check_whitespace.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/check_whitespace.py b/scripts/check_whitespace.py index dd469cba..1ab43674 100755 --- a/scripts/check_whitespace.py +++ b/scripts/check_whitespace.py @@ -27,6 +27,7 @@ def check_file(filename): # Empty files are okay return # Do checks + is_source_code = any([filename.endswith(s) for s in ['.c', '.h', '.py']]) lineno = 0 for lineno, line in enumerate(data.split('\n')): # Verify line is valid utf-8 @@ -49,6 +50,9 @@ def check_file(filename): # Check for trailing space if line.endswith(' '): report_error(filename, lineno, "Line has trailing spaces") + # Check for more than 80 characters + if is_source_code and len(line) > 80: + report_error(filename, lineno, "Line longer than 80 characters") if not data.endswith('\n'): report_error(filename, lineno, "No newline at end of file") if data.endswith('\n\n'): |