diff options
Diffstat (limited to '2025/ocaml/.githooks/commit-msg')
| -rwxr-xr-x | 2025/ocaml/.githooks/commit-msg | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/2025/ocaml/.githooks/commit-msg b/2025/ocaml/.githooks/commit-msg new file mode 100755 index 0000000..1c1c287 --- /dev/null +++ b/2025/ocaml/.githooks/commit-msg @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Commit message hook - enforce conventional commit format + +commit_regex='^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?: .{1,50}|^fixup!' + +if ! grep -qE "$commit_regex" "$1"; then + echo "❌ Invalid commit message format!" + echo "" + echo "Format: type(scope): description" + echo "Types: feat, fix, docs, style, refactor, test, chore" + echo "Example: feat(auth): add user login functionality" + echo "" + echo "Your message: $(cat $1)" + exit 1 +fi |
