-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'unstable' into feat-support-ipv6
- Loading branch information
Showing
146 changed files
with
1,117 additions
and
938 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,9 @@ download/ | |
CMakeFiles/ | ||
CMakeCache.txt | ||
|
||
# clang-format | ||
temp.txt | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) 2025-present, Arana/Kiwi Community. All rights reserved. | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
|
||
|
||
# define hooks source and target path | ||
SET(HOOKS_SOURCE_DIR "${CMAKE_SOURCE_DIR}/etc/script") | ||
set(GIT_HOOKS_DIR "${CMAKE_SOURCE_DIR}/.git/hooks") | ||
|
||
# # ensure pre-commit hook is installed | ||
# ADD_CUSTOM_TARGET(install_git_hooks | ||
# COMMAND ${CMAKE_COMMAND} -E make_directory ${GIT_HOOKS_DIR} | ||
# COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
# ${HOOKS_SOURCE_DIR}/precommit.sh | ||
# ${GIT_HOOKS_DIR}/pre-commit | ||
# COMMAND ${CMAKE_COMMAND} -E chmod 755 ${GIT_HOOKS_DIR}/pre-commit | ||
# COMMENT "Installing git hooks..." | ||
# ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# Check if clang-format is installed | ||
if ! command -v clang-format &> /dev/null; then | ||
echo "Error: clang-format is not installed" | ||
echo "Please install clang-format first" | ||
exit 1 | ||
fi | ||
|
||
# Set color output | ||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
NC='\033[0m' # No Color | ||
|
||
# Counters | ||
error_count=0 | ||
checked_count=0 | ||
|
||
# Check file | ||
check_file() { | ||
local file=$1 | ||
# Create a temporary file with formatted content | ||
clang-format $file > temp.txt | ||
|
||
# Compare the original file with the formatted file | ||
if ! diff -u "$file" temp.txt > /dev/null; then | ||
echo -e "${RED}Needs formatting: $file${NC}" | ||
# Show specific differences | ||
diff -u "$file" temp.txt | grep -E "^[\+\-]" | head -n 10 | ||
echo "..." | ||
((error_count++)) | ||
else | ||
echo -e "${GREEN}Correctly formatted: $file${NC}" | ||
fi | ||
((checked_count++)) | ||
|
||
# Clean up temporary file | ||
rm temp.txt | ||
} | ||
|
||
# Main function | ||
main() { | ||
echo "Starting code format check..." | ||
|
||
# Find all C/C++ source files | ||
while IFS= read -r -d '' file; do | ||
check_file "$file" | ||
done < <(find ./src -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" -o -name "*.cc" \) -print0) | ||
|
||
# Output summary | ||
echo "----------------------------------------" | ||
echo "Check completed!" | ||
echo "Total files checked: $checked_count" | ||
echo "Files needing formatting: $error_count" | ||
|
||
# Return non-zero if there are errors | ||
[ "$error_count" -gt 0 ] && exit 1 || exit 0 | ||
} | ||
|
||
# Run the main function | ||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# Path to the check_format.sh script | ||
SCRIPT_PATH="etc/script/check_format.sh" | ||
|
||
# Check if the script exists | ||
if [ ! -f "$SCRIPT_PATH" ]; then | ||
echo "Error: $SCRIPT_PATH not found!" | ||
exit 1 | ||
fi | ||
|
||
# Make sure the script is executable | ||
chmod +x "$SCRIPT_PATH" | ||
|
||
# Run the script on all staged files | ||
#STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cpp|cc|h|hpp|c)$') | ||
|
||
# if [ -n "$STAGED_FILES" ]; then | ||
# for file in $STAGED_FILES; do | ||
# "$SCRIPT_PATH" "$file" | ||
# if [ $? -ne 0 ]; then | ||
# echo "Commit aborted due to formatting issues." | ||
# exit 1 | ||
# fi | ||
# done | ||
# fi | ||
|
||
sh $SCRIPT_PATH | ||
|
||
exit 0 # Path to the check_format.sh script | ||
|
Oops, something went wrong.