Skip to content

Commit 041fcbb

Browse files
committed
Prohibit conventional commit format in subjects
Conventional commit formats like 'chore(scripts):', 'feat:', and 'fix(queue):' waste valuable characters from the 50-character subject line limit. These prefixes can consume 10-20 characters, leaving insufficient space for meaningful descriptions. Contributors should write direct, descriptive subjects that maximize the use of available characters for actual content rather than metadata prefixes. Change-Id: I981d66a99a8c17987975b473a7f1a5d8cdcccad8
1 parent 57addf7 commit 041fcbb

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,9 @@ In addition, this project expects contributors to follow these additional rules:
913913
* Avoid using parentheses in commit subjects.
914914
Excessive use of parentheses "()" can clutter the subject line,
915915
making it harder to quickly grasp the essential message.
916+
* Avoid conventional commit format (e.g., "chore(scripts):", "feat:", "fix:").
917+
These formats waste precious characters from the 50-character limit.
918+
Write a direct, descriptive subject instead.
916919

917920
Some conventions are automatically enforced by the [githooks](https://git-scm.com/docs/githooks).
918921

scripts/commit-msg.hook

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,20 @@ validate_commit_message() {
404404
add_warning 1 "Avoid using parentheses '()' in commit subjects"
405405
fi
406406

407-
# 7c. Alert if the commit subject starts with "Implementation"
407+
# 7c. Disallow conventional commit format (e.g., "chore(scope):", "feat:", etc.)
408+
# These formats waste precious characters from the 50-character limit
409+
# Check for patterns like "type:" or "type(scope):" with optional breaking change indicator
410+
if [[ ${COMMIT_SUBJECT} =~ ^[a-z]+\([^\)]+\):[[:space:]] ]] || [[ ${COMMIT_SUBJECT} =~ ^[a-z]+!?:[[:space:]] ]]; then
411+
add_warning 1 "Avoid conventional commit format (e.g., 'chore(scripts):', 'feat:', 'fix:'). Write a direct, descriptive subject"
412+
fi
413+
414+
# 7d. Alert if the commit subject starts with "Implementation"
408415
# ------------------------------------------------------------------------------
409416
if [[ "${COMMIT_SUBJECT_TO_PROCESS}" =~ ^(First|My|Implementation|Implementations|Creation|Modification|Queue) ]]; then
410417
add_warning 1 "Commit subject should use imperative mood"
411418
fi
412419

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

0 commit comments

Comments
 (0)