diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aceea7845..c9138edd9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -913,6 +913,9 @@ In addition, this project expects contributors to follow these additional rules: * Avoid using parentheses in commit subjects. Excessive use of parentheses "()" can clutter the subject line, making it harder to quickly grasp the essential message. +* Avoid conventional commit format (e.g., "chore(scripts):", "feat:", "fix:"). + These formats waste precious characters from the 50-character limit. + Write a direct, descriptive subject instead. Some conventions are automatically enforced by the [githooks](https://git-scm.com/docs/githooks). diff --git a/scripts/commit-msg.hook b/scripts/commit-msg.hook index 94420a401..dc6171a14 100755 --- a/scripts/commit-msg.hook +++ b/scripts/commit-msg.hook @@ -404,13 +404,20 @@ validate_commit_message() { add_warning 1 "Avoid using parentheses '()' in commit subjects" fi - # 7c. Alert if the commit subject starts with "Implementation" + # 7c. Disallow conventional commit format (e.g., "chore(scope):", "feat:", etc.) + # These formats waste precious characters from the 50-character limit + # Check for patterns like "type:" or "type(scope):" with optional breaking change indicator + if [[ ${COMMIT_SUBJECT} =~ ^[a-z]+\([^\)]+\):[[:space:]] ]] || [[ ${COMMIT_SUBJECT} =~ ^[a-z]+!?:[[:space:]] ]]; then + add_warning 1 "Avoid conventional commit format (e.g., 'chore(scripts):', 'feat:', 'fix:'). Write a direct, descriptive subject" + fi + + # 7d. Alert if the commit subject starts with "Implementation" # ------------------------------------------------------------------------------ if [[ "${COMMIT_SUBJECT_TO_PROCESS}" =~ ^(First|My|Implementation|Implementations|Creation|Modification|Queue) ]]; then add_warning 1 "Commit subject should use imperative mood" fi - # 7d. Alert if the commit subject uses the pattern "Implement of ..." + # 7e. 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