Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading