diff options
author | Kitzunu <24550914+Kitzunu@users.noreply.github.com> | 2024-12-21 22:19:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-21 22:19:49 +0100 |
commit | d2b88bdc1e851bc758cbf0fbd79ea742e29417a0 (patch) | |
tree | bbfe23dfaecbf27caff7b9e67b375e14da295ef8 /apps/codestyle | |
parent | 08d5861a519a0dc85269f76458b55dbcb77bcda0 (diff) |
feat(CI/Codestyle); Check for double semicolons (#20996)
Diffstat (limited to 'apps/codestyle')
-rw-r--r-- | apps/codestyle/codestyle.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/codestyle/codestyle.py b/apps/codestyle/codestyle.py index 5cbf1691ab..27f273799d 100644 --- a/apps/codestyle/codestyle.py +++ b/apps/codestyle/codestyle.py @@ -222,6 +222,9 @@ def misc_codestyle_check(file: io, file_path: str) -> None: # used to check for "if/else (...) {" "} else" ignores "if/else (...) {...}" "#define ... if/else (...) {" ifelse_curlyregex = r"^[^#define].*\s+(if|else)(\s*\(.*\))?\s*{[^}]*$|}\s*else(\s*{[^}]*$)" + # used to catch double semicolons ";;" ignores "(;;)" + double_semiregex = r"[^(];;[^)]" + # Parse all the file for line_number, line in enumerate(file, start = 1): if 'const auto&' in line: @@ -240,6 +243,11 @@ def misc_codestyle_check(file: io, file_path: str) -> None: print( f"Curly brackets are not allowed to be leading or trailing if/else statements. Place it on a new line: {file_path} at line {line_number}") check_failed = True + if re.match(double_semiregex, line): + print( + f"Double semicolon (;;) found in {file_path} at line {line_number}") + check_failed = True + # Handle the script error and update the result output if check_failed: error_handler = True |