feat(CI/Codestyle): Check for tabs (#20998)

This commit is contained in:
Kitzunu
2024-12-22 00:43:23 +01:00
committed by GitHub
parent 99e5d73beb
commit 2c20c9463a
2 changed files with 15 additions and 9 deletions

View File

@@ -224,6 +224,8 @@ def misc_codestyle_check(file: io, file_path: str) -> None:
ifelse_curlyregex = r"^[^#define].*\s+(if|else)(\s*\(.*\))?\s*{[^}]*$|}\s*else(\s*{[^}]*$)"
# used to catch double semicolons ";;" ignores "(;;)"
double_semiregex = r"[^(];;[^)]"
# used to catch tabs
tab_regex = r"\t"
# Parse all the file
for line_number, line in enumerate(file, start = 1):
@@ -247,6 +249,10 @@ def misc_codestyle_check(file: io, file_path: str) -> None:
print(
f"Double semicolon (;;) found in {file_path} at line {line_number}")
check_failed = True
if re.match(tab_regex, line):
print(
f"Tab found! Replace it to 4 spaces: {file_path} at line {line_number}")
check_failed = True
# Handle the script error and update the result output
if check_failed: