22
33# This script checks:
44# 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
79#
810# Merge commits are excluded from this check.
911
@@ -23,31 +25,9 @@ BASE_COMMIT="0b8be2c15160c216e8b6ec82c99a000e81c0e429"
2325# Get a list of non-merge commit hashes after BASE_COMMIT.
2426commits=$( git rev-list --no-merges " ${BASE_COMMIT} " ..HEAD)
2527
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-
4128# Early exit if no commits to check
4229[[ -z " $commits " ]] && { echo -e " ${GREEN} No commits to check.${NC} " ; exit 0; }
4330
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-
5131# Ultra-fast approach: minimize git calls and parsing overhead
5232failed=0
5333warnings=0
@@ -122,11 +102,11 @@ for commit in "${!commit_cache[@]}"; do
122102 (( failed++ ))
123103 fi
124104
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
128108 has_warnings=1
129- warning_list+=" Contains bypass indicator: ' ${BASH_REMATCH[1]} ' |"
109+ warning_list+=" Work in progress commit |"
130110 (( warnings++ ))
131111 fi
132112
0 commit comments