mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
feat(CI/Codestyle): Check for tabs (#20998)
This commit is contained in:
@@ -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*{[^}]*$)"
|
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"[^(];;[^)]"
|
||||||
|
# used to catch tabs
|
||||||
|
tab_regex = r"\t"
|
||||||
|
|
||||||
# Parse all the file
|
# Parse all the file
|
||||||
for line_number, line in enumerate(file, start = 1):
|
for line_number, line in enumerate(file, start = 1):
|
||||||
@@ -247,6 +249,10 @@ def misc_codestyle_check(file: io, file_path: str) -> None:
|
|||||||
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
|
||||||
|
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
|
# Handle the script error and update the result output
|
||||||
if check_failed:
|
if check_failed:
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ if(WIN32)
|
|||||||
|
|
||||||
set(_MYSQL_ROOT_PATHS
|
set(_MYSQL_ROOT_PATHS
|
||||||
${_MYSQL_ROOT_PATHS}
|
${_MYSQL_ROOT_PATHS}
|
||||||
${_MYSQL_ROOT_PATHS_VERSION_SUBDIRECTORIES}
|
${_MYSQL_ROOT_PATHS_VERSION_SUBDIRECTORIES}
|
||||||
"${PROGRAM_FILES_64}/MySQL"
|
"${PROGRAM_FILES_64}/MySQL"
|
||||||
"${PROGRAM_FILES_32}/MySQL"
|
"${PROGRAM_FILES_32}/MySQL"
|
||||||
"$ENV{SystemDrive}/MySQL"
|
"$ENV{SystemDrive}/MySQL"
|
||||||
@@ -180,7 +180,7 @@ find_path(MYSQL_INCLUDE_DIR
|
|||||||
/usr/local/include
|
/usr/local/include
|
||||||
/usr/local/include/mysql
|
/usr/local/include/mysql
|
||||||
/usr/local/mysql/include
|
/usr/local/mysql/include
|
||||||
${_MYSQL_ROOT_PATHS}
|
${_MYSQL_ROOT_PATHS}
|
||||||
PATH_SUFFIXES
|
PATH_SUFFIXES
|
||||||
include
|
include
|
||||||
include/mysql
|
include/mysql
|
||||||
@@ -270,10 +270,10 @@ set(MYSQL_REQUIRED_VARS "")
|
|||||||
foreach(_comp IN LISTS MySQL_FIND_COMPONENTS)
|
foreach(_comp IN LISTS MySQL_FIND_COMPONENTS)
|
||||||
if(_comp STREQUAL "lib")
|
if(_comp STREQUAL "lib")
|
||||||
set(MySQL_${_comp}_WANTED TRUE)
|
set(MySQL_${_comp}_WANTED TRUE)
|
||||||
if(MySQL_FIND_REQUIRED_${_comp})
|
if(MySQL_FIND_REQUIRED_${_comp})
|
||||||
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_LIBRARY")
|
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_LIBRARY")
|
||||||
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_INCLUDE_DIR")
|
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_INCLUDE_DIR")
|
||||||
endif()
|
endif()
|
||||||
if(EXISTS "${MYSQL_LIBRARY}" AND EXISTS "${MYSQL_INCLUDE_DIR}")
|
if(EXISTS "${MYSQL_LIBRARY}" AND EXISTS "${MYSQL_INCLUDE_DIR}")
|
||||||
set(MySQL_${_comp}_FOUND TRUE)
|
set(MySQL_${_comp}_FOUND TRUE)
|
||||||
else()
|
else()
|
||||||
@@ -281,9 +281,9 @@ foreach(_comp IN LISTS MySQL_FIND_COMPONENTS)
|
|||||||
endif()
|
endif()
|
||||||
elseif(_comp STREQUAL "binary")
|
elseif(_comp STREQUAL "binary")
|
||||||
set(MySQL_${_comp}_WANTED TRUE)
|
set(MySQL_${_comp}_WANTED TRUE)
|
||||||
if(MySQL_FIND_REQUIRED_${_comp})
|
if(MySQL_FIND_REQUIRED_${_comp})
|
||||||
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_EXECUTABLE")
|
list(APPEND MYSQL_REQUIRED_VARS "MYSQL_EXECUTABLE")
|
||||||
endif()
|
endif()
|
||||||
if(EXISTS "${MYSQL_EXECUTABLE}" )
|
if(EXISTS "${MYSQL_EXECUTABLE}" )
|
||||||
set(MySQL_${_comp}_FOUND TRUE)
|
set(MySQL_${_comp}_FOUND TRUE)
|
||||||
else()
|
else()
|
||||||
|
|||||||
Reference in New Issue
Block a user