Skip to content

Commit

Permalink
Provide more verbs for checking commit message
Browse files Browse the repository at this point in the history
The commit e4ad8ec was limited to the subject starting with "Update,"
and the checker captures  additional verbs like "Fix" and "Improve."

Change-Id: I8f155ec1a8a6277272cf32c541ada1d182b82501
  • Loading branch information
jserv committed Feb 22, 2025
1 parent de3b2ca commit 0770f78
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/commit-msg.hook
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ validate_commit_message() {
# 11. Avoid commit subject that simply states a file update (e.g. "Update console.c")
# ------------------------------------------------------------------------------

if [[ ${COMMIT_SUBJECT_TO_PROCESS} =~ ^Update[[:space:]]+([^[:space:]]+)$ ]]; then
candidate="${BASH_REMATCH[1]}"
if [[ "$COMMIT_SUBJECT_TO_PROCESS" =~ ^(Update|Modify|Change|Fix|Refine|Improve|Revise)[[:space:]]+([^[:space:]]+)$ ]]; then
candidate="${BASH_REMATCH[2]}"
# Only warn if the candidate filename ends with .c or .h
if [[ $candidate =~ \.(c|h)$ ]]; then
add_warning 1 "Avoid using just a filename like '$candidate'. Provide a functional, meaningful description"
if [[ "$candidate" =~ \.(c|h)$ ]]; then
add_warning 1 "Avoid using just a filename like '$candidate'. Provide a functional, meaningful description"
fi
fi

Expand Down

0 comments on commit 0770f78

Please sign in to comment.