diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -51,6 +51,20 @@ def normalize_whitespace(file_paths): result = map(reindent.check, (x for x in file_paths if x.endswith('.py'))) return sum(result) +@status("Checking for tabs in C files", info=lambda x: "%s files" % x) +def check_tabs(file_paths): + """Report if any .c/.h file contains a tab""" + cfiles = (x for x in file_paths if x.endswith(('.c', '.h'))) + result = 0 + for filename in cfiles: + with open(filename) as fp: + for line in fp: + if '\t' in line: + result += 1 + break + return result + @status("Docs modified", modal=True) def docs_modified(file_paths): """Report if any files in the Docs directory.""" @@ -74,6 +88,7 @@ def main(): file_paths = changed_files() # PEP 7/8 verification. normalize_whitespace(file_paths) + check_tabs(file_paths) # Docs updated. docs_modified(file_paths) # Misc/ACKS changed.