From 787b4e4efe8c81e82e3926cb3a51a96bfa97af2a Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Mon, 10 Feb 2025 20:24:28 +0100 Subject: [PATCH] fix(CI/Codestyle): correct double semicolon check (#21388) --- apps/codestyle/codestyle-cpp.py | 4 ++-- src/server/scripts/Commands/cs_worldstate.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/codestyle/codestyle-cpp.py b/apps/codestyle/codestyle-cpp.py index 77ff3f376..7b0dea93f 100644 --- a/apps/codestyle/codestyle-cpp.py +++ b/apps/codestyle/codestyle-cpp.py @@ -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 (...) {" ifelse_curlyregex = r"^[^#define].*\s+(if|else)(\s*\(.*\))?\s*{[^}]*$|}\s*else(\s*{[^}]*$)" # used to catch double semicolons ";;" ignores "(;;)" - double_semiregex = r"[^(];;[^)]" + double_semiregex = r"(? 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): + if re.search(double_semiregex, line): print( f"Double semicolon (;;) found in {file_path} at line {line_number}") check_failed = True diff --git a/src/server/scripts/Commands/cs_worldstate.cpp b/src/server/scripts/Commands/cs_worldstate.cpp index 7c1887b1c..40b37d6c5 100644 --- a/src/server/scripts/Commands/cs_worldstate.cpp +++ b/src/server/scripts/Commands/cs_worldstate.cpp @@ -83,7 +83,7 @@ public: handler->PSendSysMessage("Invalid subphase, see \".worldstate sunsreach subphase\" for usage"); return false; } - sWorldState->HandleSunsReachSubPhaseTransition(subphase);; + sWorldState->HandleSunsReachSubPhaseTransition(subphase); handler->PSendSysMessage(sWorldState->GetSunsReachPrintout()); return true; }