Skip to content

Commit

Permalink
feat(CI/Codestyle): Check for tabs (azerothcore#20998)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kitzunu authored Dec 21, 2024
1 parent 99e5d73 commit 2c20c94
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 6 additions & 0 deletions apps/codestyle/codestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions src/cmake/macros/FindMySQL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ if(WIN32)

set(_MYSQL_ROOT_PATHS
${_MYSQL_ROOT_PATHS}
${_MYSQL_ROOT_PATHS_VERSION_SUBDIRECTORIES}
${_MYSQL_ROOT_PATHS_VERSION_SUBDIRECTORIES}
"${PROGRAM_FILES_64}/MySQL"
"${PROGRAM_FILES_32}/MySQL"
"$ENV{SystemDrive}/MySQL"
Expand All @@ -180,7 +180,7 @@ find_path(MYSQL_INCLUDE_DIR
/usr/local/include
/usr/local/include/mysql
/usr/local/mysql/include
${_MYSQL_ROOT_PATHS}
${_MYSQL_ROOT_PATHS}
PATH_SUFFIXES
include
include/mysql
Expand Down Expand Up @@ -270,20 +270,20 @@ set(MYSQL_REQUIRED_VARS "")
foreach(_comp IN LISTS MySQL_FIND_COMPONENTS)
if(_comp STREQUAL "lib")
set(MySQL_${_comp}_WANTED TRUE)
if(MySQL_FIND_REQUIRED_${_comp})
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_LIBRARY")
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_INCLUDE_DIR")
endif()
if(MySQL_FIND_REQUIRED_${_comp})
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_LIBRARY")
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_INCLUDE_DIR")
endif()
if(EXISTS "${MYSQL_LIBRARY}" AND EXISTS "${MYSQL_INCLUDE_DIR}")
set(MySQL_${_comp}_FOUND TRUE)
else()
set(MySQL_${_comp}_FOUND FALSE)
endif()
elseif(_comp STREQUAL "binary")
set(MySQL_${_comp}_WANTED TRUE)
if(MySQL_FIND_REQUIRED_${_comp})
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_EXECUTABLE")
endif()
if(MySQL_FIND_REQUIRED_${_comp})
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_EXECUTABLE")
endif()
if(EXISTS "${MYSQL_EXECUTABLE}" )
set(MySQL_${_comp}_FOUND TRUE)
else()
Expand Down

0 comments on commit 2c20c94

Please sign in to comment.