feat: Improved commit githooks messages

This commit is contained in:
MikeWallaceDev 2022-07-25 12:20:55 -04:00
parent f993e1d076
commit c45e4515bb
3 changed files with 62 additions and 9 deletions

View File

@ -6,7 +6,24 @@
# status after issuing an appropriate message if it wants to stop the # status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file. # commit. The hook is allowed to edit the commit message file.
echo "Running the AppFlowy commit-msg hook." YELLOW="\e[93m"
GREEN="\e[32m"
RED="\e[31m"
ENDCOLOR="\e[0m"
printMessage() {
printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n"
}
printSuccess() {
printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n"
}
printError() {
printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
}
printMessage "Running the AppFlowy commit-msg hook."
# This example catches duplicate Signed-off-by lines. # This example catches duplicate Signed-off-by lines.
@ -27,7 +44,8 @@ test "" = "$(grep '^Signed-off-by: ' "$1" |
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Please fix your commit message to match AppFlowy coding standards" printError "Please fix your commit message to match AppFlowy coding standards"
printError "https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/software-contributions/submitting-code/style-guides"
exit 1 exit 1
fi fi

View File

@ -1,6 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "Running local AppFlowy pre-commit hook." YELLOW="\e[93m"
GREEN="\e[32m"
RED="\e[31m"
ENDCOLOR="\e[0m"
printMessage() {
printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n"
}
printSuccess() {
printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n"
}
printError() {
printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
}
printMessage "Running local AppFlowy pre-commit hook."
#flutter format . #flutter format .
##https://gist.github.com/benmccallum/28e4f216d9d72f5965133e6c43aaff6e ##https://gist.github.com/benmccallum/28e4f216d9d72f5965133e6c43aaff6e

View File

@ -1,23 +1,41 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "Running local AppFlowy pre-push hook." YELLOW="\e[93m"
GREEN="\e[32m"
RED="\e[31m"
ENDCOLOR="\e[0m"
printMessage() {
printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n"
}
printSuccess() {
printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n"
}
printError() {
printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
}
printMessage "Running local AppFlowy pre-push hook."
if [[ `git status --porcelain` ]]; then if [[ `git status --porcelain` ]]; then
printf "\e[31;1m%s\e[0m\n" 'This script needs to run against committed code only. Please commit or stash you changes.' printError "This script needs to run against committed code only. Please commit or stash you changes."
exit 1 exit 1
fi fi
printf "\e[33;1m%s\e[0m\n" 'Running the Flutter analyzer' printMessage "Running the Flutter analyzer"
flutter analyze flutter analyze
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
printf "\e[31;1m%s\e[0m\n" 'Flutter analyzer error' printError "Flutter analyzer error"
exit 1 exit 1
fi fi
printf "\e[33;1m%s\e[0m\n" 'Finished running the Flutter analyzer' printMessage "Finished running the Flutter analyzer"
printf "\e[33;1m%s\e[0m\n" 'Running unit tests'
#printMessage "Running unit tests"
#flutter test #flutter test
#if [ $? -ne 0 ]; then #if [ $? -ne 0 ]; then
# printf "\e[31;1m%s\e[0m\n" 'Unit tests error' # printf "\e[31;1m%s\e[0m\n" 'Unit tests error'