feat(CI/Codestyle): Check for tabs (#20998)

This commit is contained in:
Kitzunu 2024-12-22 00:43:23 +01:00 committed by GitHub
parent 99e5d73beb
commit 2c20c9463a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 9 deletions

View File

@ -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):
@ -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:

View File

@ -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"
@ -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
@ -270,10 +270,10 @@ 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()
@ -281,9 +281,9 @@ foreach(_comp IN LISTS MySQL_FIND_COMPONENTS)
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()