File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,20 @@ if ! command -v git &>/dev/null; then
20
20
throw " git not installed."
21
21
fi
22
22
23
+ # Retrieve git email.
24
+ GIT_EMAIL=$( git config user.email)
25
+
26
+ # Check if email is set.
27
+ if [ -z " $GIT_EMAIL " ]; then
28
+ throw " Git email is not set."
29
+ fi
30
+
31
+ # Validate email using a regex.
32
+ # This regex matches a basic email pattern.
33
+ if ! [[ " $GIT_EMAIL " =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\. [A-Za-z]{2,}$ ]]; then
34
+ throw " Git email '$GIT_EMAIL ' is not valid."
35
+ fi
36
+
23
37
# 1. Sleep for a random number of milliseconds
24
38
# The time interval is important to reduce unintended network traffic.
25
39
(( CURRENT_STEP++ ))
Original file line number Diff line number Diff line change @@ -300,6 +300,11 @@ done
300
300
add_warning 1 " Commit subject should use imperative mood"
301
301
fi
302
302
303
+ # 7d. Alert if the commit subject uses the pattern "Implement of ..."
304
+ if [[ " ${COMMIT_SUBJECT_TO_PROCESS} " =~ ^(Implement| Realize| Update| Finish| Code)[[:space:]]+of[[:space:]]+ ]]; then
305
+ add_warning 1 " Avoid using 'of' immediately after the verb"
306
+ fi
307
+
303
308
# 8. Use the body to explain what and why vs. how
304
309
# ------------------------------------------------------------------------------
305
310
You can’t perform that action at this time.
0 commit comments