forked from Archive/PX4-Autopilot
astyle scripting move to Tools/astyle
This commit is contained in:
parent
a02caff1bc
commit
9f15c572a3
|
@ -40,12 +40,12 @@
|
||||||
"options_c":
|
"options_c":
|
||||||
{
|
{
|
||||||
"use_only_additional_options": true,
|
"use_only_additional_options": true,
|
||||||
"additional_options_file": "${project_path}/Tools/astylerc"
|
"additional_options_file": "${project_path}/Tools/astyle/astylerc"
|
||||||
},
|
},
|
||||||
"options_c++":
|
"options_c++":
|
||||||
{
|
{
|
||||||
"use_only_additional_options": true,
|
"use_only_additional_options": true,
|
||||||
"additional_options_file": "${project_path}/Tools/astylerc"
|
"additional_options_file": "${project_path}/Tools/astyle/astylerc"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -300,12 +300,12 @@ s3put_coverage: tests_coverage
|
||||||
|
|
||||||
check_format:
|
check_format:
|
||||||
$(call colorecho,"Checking formatting with astyle")
|
$(call colorecho,"Checking formatting with astyle")
|
||||||
@$(SRC_DIR)/Tools/check_code_style_all.sh
|
@$(SRC_DIR)/Tools/astyle/check_code_style_all.sh
|
||||||
@git diff --check
|
@git diff --check
|
||||||
|
|
||||||
format:
|
format:
|
||||||
$(call colorecho,"Formatting with astyle")
|
$(call colorecho,"Formatting with astyle")
|
||||||
@$(SRC_DIR)/Tools/check_code_style_all.sh --fix
|
@$(SRC_DIR)/Tools/astyle/check_code_style_all.sh --fix
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
|
|
@ -16,7 +16,7 @@ if [ -f "$FILE" ]; then
|
||||||
if [[ $PX4_ASTYLE_FIX -eq 1 ]]; then
|
if [[ $PX4_ASTYLE_FIX -eq 1 ]]; then
|
||||||
${DIR}/fix_code_style.sh $FILE
|
${DIR}/fix_code_style.sh $FILE
|
||||||
else
|
else
|
||||||
echo $FILE 'bad formatting, please run "make format" or "./Tools/fix_code_style.sh' $FILE'"'
|
echo $FILE 'bad formatting, please run "make format" or "./Tools/astyle/fix_code_style.sh' $FILE'"'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
|
@ -41,15 +41,15 @@ fi
|
||||||
|
|
||||||
|
|
||||||
# install git pre-commit hook
|
# install git pre-commit hook
|
||||||
HOOK_FILE="$DIR/../.git/hooks/pre-commit"
|
HOOK_FILE="$DIR/../../.git/hooks/pre-commit"
|
||||||
if [ ! -f $HOOK_FILE ] && [ "$CI" != "true" ]; then
|
if [ ! -f $HOOK_FILE ] && [ "$CI" != "true" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\033[31mNinja tip: add a git pre-commit hook to automatically check code style\033[0m"
|
echo -e "\033[31mNinja tip: add a git pre-commit hook to automatically check code style\033[0m"
|
||||||
echo -e "Would you like to install one now? (\033[94mcp ./Tools/pre-commit .git/hooks/pre-commit\033[0m): [y/\033[1mN\033[0m]"
|
echo -e "Would you like to install one now? (\033[94mcp ./Tools/astyle/pre-commit .git/hooks/pre-commit\033[0m): [y/\033[1mN\033[0m]"
|
||||||
|
|
||||||
read user_cmd
|
read user_cmd
|
||||||
if [ "$user_cmd" == "y" ]; then
|
if [ "$user_cmd" == "y" ]; then
|
||||||
echo -e "copying ./Tools/pre-commit -> .git/hooks/pre-commit"
|
echo -e "copying ./Tools/astyle/pre-commit -> .git/hooks/pre-commit"
|
||||||
mkdir -p $DIR/../.git/hooks
|
mkdir -p $DIR/../.git/hooks
|
||||||
cp $DIR/pre-commit $HOOK_FILE
|
cp $DIR/pre-commit $HOOK_FILE
|
||||||
echo -e "\033[94mGreat, hook installed!\033[0m (checking style now)"
|
echo -e "\033[94mGreat, hook installed!\033[0m (checking style now)"
|
|
@ -56,7 +56,7 @@ fi
|
||||||
# Check for code style, only in changed files
|
# Check for code style, only in changed files
|
||||||
for i in `git diff --cached --name-only --diff-filter=ACM`
|
for i in `git diff --cached --name-only --diff-filter=ACM`
|
||||||
do
|
do
|
||||||
./Tools/files_to_check_code_style.sh $i | xargs -n 1 -P 8 -I % ./Tools/check_code_style.sh %
|
./Tools/astyle/files_to_check_code_style.sh $i | xargs -n 1 -P 8 -I % ./Tools/astyle/check_code_style.sh %
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
Loading…
Reference in New Issue