# HG changeset patch # User Éric Araujo # Date 1276464684 -7200 # Branch trunk # Node ID 114e3c805f20caf210ceb788fe2a6c80acb66f83 # Parent d84c6fde184ea1092ab8be5a724a9abce300c931 "make patchcheck" now reports tabs in C files 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", info=lambda x: "%s files" % x) +def check_tabs(file_paths): + """Report if any C file contains a tab""" + cfiles = (x for x in file_paths if x.endswith('.c')) + 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.