Better detection of tab indentation.

"But surely nobody would indent by having spaces first,
and tabs after that. Right? Right?"
This commit is contained in:
Jussi Pakkanen 2019-05-09 21:46:22 +03:00
parent d31db565e1
commit b0f90a793f
2 changed files with 12 additions and 11 deletions

View File

@ -702,9 +702,10 @@ def check_file(fname):
linenum = 1 linenum = 1
with open(fname, 'rb') as f: with open(fname, 'rb') as f:
lines = f.readlines() lines = f.readlines()
tabdetector = re.compile(br' *\t')
for line in lines: for line in lines:
if line.startswith(b'\t'): if re.match(tabdetector, line):
print("File %s contains a literal tab on line %d. Only spaces are permitted." % (fname, linenum)) print("File %s contains a tab indent on line %d. Only spaces are permitted." % (fname, linenum))
sys.exit(1) sys.exit(1)
if b'\r' in line: if b'\r' in line:
print("File %s contains DOS line ending on line %d. Only unix-style line endings are permitted." % (fname, linenum)) print("File %s contains DOS line ending on line %d. Only unix-style line endings are permitted." % (fname, linenum))

View File

@ -4,14 +4,14 @@
int main() int main()
{ {
VkInstanceCreateInfo instance_create_info = { VkInstanceCreateInfo instance_create_info = {
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
NULL, NULL,
0, 0,
NULL, NULL,
0, 0,
NULL, NULL,
0, 0,
NULL, NULL,
}; };
// we don't actually require instance creation to succeed since // we don't actually require instance creation to succeed since
@ -23,4 +23,4 @@ int main()
vkDestroyInstance(instance, NULL); vkDestroyInstance(instance, NULL);
return 0; return 0;
} }