2
2
3
3
# This script checks:
4
4
# 1. Change-Id presence (indicates commit-msg hook processing)
5
- # 2. Commit message quality (indicates pre-commit hook compliance)
6
- # 3. Bypass detection (detects --no-verify usage or web interface commits)
5
+ # 2. Commit message quality (subject line format and length)
6
+ # 3. WIP commits detection (work-in-progress commits that start with WIP:)
7
+ # 4. GitHub web interface usage (commits without proper hooks)
8
+ # 5. Queue.c modifications require descriptive commit body
7
9
#
8
10
# Merge commits are excluded from this check.
9
11
@@ -23,31 +25,9 @@ BASE_COMMIT="0b8be2c15160c216e8b6ec82c99a000e81c0e429"
23
25
# Get a list of non-merge commit hashes after BASE_COMMIT.
24
26
commits=$( git rev-list --no-merges " ${BASE_COMMIT} " ..HEAD)
25
27
26
- # Hook bypass detection patterns
27
- BYPASS_INDICATORS=(
28
- " --no-verify"
29
- " WIP"
30
- )
31
-
32
- # Quality patterns that indicate hook processing
33
- PROBLEMATIC_PATTERNS=(
34
- ' ^[a-z]' # Uncapitalized subjects
35
- ' \.$' # Ending with period
36
- ' ^.{1,10}$' # Too short subjects
37
- ' ^.{80,}' # Too long subjects
38
- ' ^(Update|Fix|Change|Modify) [a-zA-Z0-9_-]+\.(c|h)$' # Generic filename updates
39
- )
40
-
41
28
# Early exit if no commits to check
42
29
[[ -z " $commits " ]] && { echo -e " ${GREEN} No commits to check.${NC} " ; exit 0; }
43
30
44
- # Pre-compute indicator patterns for faster matching
45
- bypass_pattern=" "
46
- for indicator in " ${BYPASS_INDICATORS[@]} " ; do
47
- bypass_pattern+=" |${indicator,,} "
48
- done
49
- bypass_pattern=" ${bypass_pattern# |} "
50
-
51
31
# Ultra-fast approach: minimize git calls and parsing overhead
52
32
failed=0
53
33
warnings=0
@@ -122,11 +102,11 @@ for commit in "${!commit_cache[@]}"; do
122
102
(( failed++ ))
123
103
fi
124
104
125
- # Check 2: Bypass indicators (single pattern match)
126
- full_msg_lower= " ${full_msg,,} "
127
- if [[ " $full_msg_lower " =~ ( $bypass_pattern ) ]]; then
105
+ # Check 2: Bypass indicators - only for actual WIP commits
106
+ # Skip commits that are documenting features (like this commit checker itself)
107
+ if [[ " $subject " =~ ^WIP[[:space:]] * : ]] || [[ " $subject " =~ ^wip[[:space:]] * : ]]; then
128
108
has_warnings=1
129
- warning_list+=" Contains bypass indicator: ' ${BASH_REMATCH[1]} ' |"
109
+ warning_list+=" Work in progress commit |"
130
110
(( warnings++ ))
131
111
fi
132
112
0 commit comments