summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'BuildTools/CheckTabs.py')
-rwxr-xr-xBuildTools/CheckTabs.py36
1 files changed, 12 insertions, 24 deletions
diff --git a/BuildTools/CheckTabs.py b/BuildTools/CheckTabs.py
index e2029b0..f0ec0ab 100755
--- a/BuildTools/CheckTabs.py
+++ b/BuildTools/CheckTabs.py
@@ -5,27 +5,15 @@ import os, sys
foundExpandedTabs = False
filename = sys.argv[1]
-if (filename.endswith(".cpp") or filename.endswith(".h") or filename.endswith(".py") or filename.endswith("SConscript") or filename.endswith("SConscript.boot") or filename.endswith("SConstruct")) and not "3rdParty" in filename :
- file = open(filename, "r")
- contents = []
- contentsChanged = False
- for line in file.readlines() :
- newline = ""
- previousChar = None
- pastInitialSpace = False
- for char in line :
- if not pastInitialSpace :
- if char == ' ' and previousChar == ' ' :
- contentsChanged = True
- previousChar = '\t'
- continue
- pastInitialSpace = (char != ' ')
- if previousChar :
- newline += previousChar
- previousChar = char
- if previousChar :
- newline += previousChar
- contents.append(newline)
- file.close()
- if contentsChanged :
- sys.exit(-1)
+if (filename.endswith(".cpp") or filename.endswith(".h") or filename.endswith(".c") or filename.endswith(".mm") or filename.endswith(".ipp") or filename.endswith(".hpp") or filename.endswith(".py") or filename.endswith("SConscript") or filename.endswith("SConscript.boot") or filename.endswith("SConstruct")) and not "3rdParty" in filename :
+ file = open(filename, "r")
+ contents = []
+ contentsChanged = False
+ for line in file.readlines() :
+ if "\t" in line:
+ print("File %s contains hard tabs. This is not allowed." % filename)
+ file.close()
+ sys.exit(-1)
+ file.close()
+ if contentsChanged :
+ sys.exit(-1)