aboutsummaryrefslogtreecommitdiff
path: root/run_project_tests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-05-09 21:46:22 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2019-05-09 22:38:44 +0300
commitb0f90a793f5ef3e08aa51549773581dff862ddb7 (patch)
treebe4507713dc93a106792ab83f16235ea10f161fc /run_project_tests.py
parentd31db565e1405b303390db6502da959e4f5fe62f (diff)
downloadmeson-b0f90a793f5ef3e08aa51549773581dff862ddb7.zip
meson-b0f90a793f5ef3e08aa51549773581dff862ddb7.tar.gz
meson-b0f90a793f5ef3e08aa51549773581dff862ddb7.tar.bz2
Better detection of tab indentation.
"But surely nobody would indent by having spaces first, and tabs after that. Right? Right?"
Diffstat (limited to 'run_project_tests.py')
-rwxr-xr-xrun_project_tests.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index 324d824..b9077c9 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -702,9 +702,10 @@ def check_file(fname):
linenum = 1
with open(fname, 'rb') as f:
lines = f.readlines()
+ tabdetector = re.compile(br' *\t')
for line in lines:
- if line.startswith(b'\t'):
- print("File %s contains a literal tab on line %d. Only spaces are permitted." % (fname, linenum))
+ if re.match(tabdetector, line):
+ print("File %s contains a tab indent on line %d. Only spaces are permitted." % (fname, linenum))
sys.exit(1)
if b'\r' in line:
print("File %s contains DOS line ending on line %d. Only unix-style line endings are permitted." % (fname, linenum))