Skip to content

Commit a556b1b

Browse files
committed
chore(git): update hooks
1 parent 450a1be commit a556b1b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.dev/githooks/commit-msg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ scopes_file=".dev/scopes.txt"
55
test -r $scopes_file &&
66
scopes="($(cat "$scopes_file" | sed '/^\(#.*\|\)$/d' | sed ':a;N;s/\n/|/g;ta'))"
77

8-
head -1 "$1" | grep -Eq "^(fix|feat|docs|style|refactor|test|chore|rework|release)(\(${scopes:-.*}(/.+)?\))?: [A-Za-z]"
8+
head -1 "$1" | grep -Eq "^(fix|feat|docs|style|refactor|test|chore|rework|release|revert)(\(${scopes:-.*}(/.+)?\))?: [A-Za-z]"
99
result=$?
1010
if test $result -ne 0
1111
then printf "Invalid commit message: '$(head -1 "$1")'
12-
Please check the guidelines at https://karma-runner.github.io/6.2/dev/git-commit-msg.html$(test -n "$scopes" && echo ", the scope should be one of $scopes as defined in $scopes_file")" >&2
12+
Please check the guidelines at http://karma-runner.github.io/6.2/dev/git-commit-msg.html$(test -n "$scopes" && echo " with the scope one of $scopes as defined in $scopes_file")" >&2
1313
fi
1414
exit $result

.dev/githooks/prepare-commit-msg

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ then
3535
expr substr "$common" 1 "$count")
3636
{
3737
# Infer type & scope from changed files
38-
expr "$path" : "gradle" >/dev/null &&
39-
printf "chore(gradle): " ||
40-
printf "fix(%s): " $path
38+
expr "$path" : ".dev" >/dev/null &&
39+
printf "feat(dev): "
40+
# Example for gradle projects
41+
expr "$path" : "gradle" \| "$path" : "build" >/dev/null &&
42+
printf "chore(gradle): "
4143

4244
printf "\n\n# Please enter the message in the format\n"
4345
echo "# <type>(<scope>): <description>"
44-
echo "# Possible types: fix, feat, docs, style, refactor, test, chore, rework, release"
46+
echo "# Possible types: fix, feat, docs, style, refactor, test, chore"
4547
test -n "$scopes" && echo "# Allowed scopes: $scopes"
46-
printf "# For details see https://www.notion.so/softwarechallenge/Git-217333329ea64db5b2cc8bbbaf79db87"
48+
echo "# For details see https://www.notion.so/softwarechallenge/Git-217333329ea64db5b2cc8bbbaf79db87"
4749
echo "$original"
4850
} > "$COMMIT_MSG_FILE"
4951
fi

0 commit comments

Comments
 (0)