Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/check-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ if ! command -v git &>/dev/null; then
throw "git not installed."
fi

# Retrieve git email.
GIT_EMAIL=$(git config user.email)

# Check if email is set.
if [ -z "$GIT_EMAIL" ]; then
throw "Git email is not set."
fi

# Validate email using a regex.
# This regex matches a basic email pattern.
if ! [[ "$GIT_EMAIL" =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$ ]]; then
throw "Git email '$GIT_EMAIL' is not valid."
fi

# 1. Sleep for a random number of milliseconds
# The time interval is important to reduce unintended network traffic.
((CURRENT_STEP++))
Expand Down
5 changes: 5 additions & 0 deletions scripts/commit-msg.hook
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ done
add_warning 1 "Commit subject should use imperative mood"
fi

# 7d. Alert if the commit subject uses the pattern "Implement of ..."
if [[ "${COMMIT_SUBJECT_TO_PROCESS}" =~ ^(Implement|Realize|Update|Finish|Code)[[:space:]]+of[[:space:]]+ ]]; then
add_warning 1 "Avoid using 'of' immediately after the verb"
fi

# 8. Use the body to explain what and why vs. how
# ------------------------------------------------------------------------------

Expand Down