fix(CI/Codestyle): correct double semicolon check (#21388)

This commit is contained in:
Kitzunu
2025-02-10 20:24:28 +01:00
committed by GitHub
parent 017cfb7b4b
commit 787b4e4efe
2 changed files with 3 additions and 3 deletions

View File

@@ -223,7 +223,7 @@ def misc_codestyle_check(file: io, file_path: str) -> None:
# used to check for "if/else (...) {" "} else" ignores "if/else (...) {...}" "#define ... if/else (...) {" # 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*{[^}]*$)" ifelse_curlyregex = r"^[^#define].*\s+(if|else)(\s*\(.*\))?\s*{[^}]*$|}\s*else(\s*{[^}]*$)"
# used to catch double semicolons ";;" ignores "(;;)" # used to catch double semicolons ";;" ignores "(;;)"
double_semiregex = r"[^(];;[^)]" double_semiregex = r"(?<!\()\s*;;(?!\))"
# used to catch tabs # used to catch tabs
tab_regex = r"\t" tab_regex = r"\t"
@@ -245,7 +245,7 @@ def misc_codestyle_check(file: io, file_path: str) -> None:
print( 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}") 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 check_failed = True
if re.match(double_semiregex, line): if re.search(double_semiregex, line):
print( print(
f"Double semicolon (;;) found in {file_path} at line {line_number}") f"Double semicolon (;;) found in {file_path} at line {line_number}")
check_failed = True check_failed = True

View File

@@ -83,7 +83,7 @@ public:
handler->PSendSysMessage("Invalid subphase, see \".worldstate sunsreach subphase\" for usage"); handler->PSendSysMessage("Invalid subphase, see \".worldstate sunsreach subphase\" for usage");
return false; return false;
} }
sWorldState->HandleSunsReachSubPhaseTransition(subphase);; sWorldState->HandleSunsReachSubPhaseTransition(subphase);
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout()); handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
return true; return true;
} }