[COMMIT_EDITMSG]
BasedOnStyles = Commits, Conventional, Commitlint
Commitlint.HeaderLength[max] = 72
Commits.Imperative = error
Conventional.Footer = NO#!/bin/sh
# .git/hooks/commit-msg
exec vale --path=COMMIT_EDITMSG < "$1"$ git config core.hooksPath script# lefthook.yml
commit-msg:
commands:
vale:
run: vale --path=COMMIT_EDITMSG < {1}# .pre-commit-config.yaml
- repo: local
hooks:
- id: vale-commit-msg
name: vale
entry: sh -c 'vale --path=COMMIT_EDITMSG < "$1"' --
language: system
stages: [commit-msg]git log -1 --format=%B | vale --path=COMMIT_EDITMSG
for sha in $(git rev-list "$BASE..HEAD"); do
git log -1 --format=%B "$sha" | vale --path=COMMIT_EDITMSG || status=1
done
gh pr view --json body -q .body | vale --path=COMMIT_EDITMSG$ vale --output=commitlint.tmpl --path=COMMIT_EDITMSG < .git/COMMIT_EDITMSG
⧗ input: COMMIT_EDITMSG
✖ Start with a type, then a colon: 'fix: ...', 'feat(scope)!: ...'. 'Fixed' is not one. [Conventional.Type]
✖ A subject does not end with a period. [Commitlint.FullStop]
⚠ Write the subject as a command: 'Add', not 'Fixed'. [Commits.Imperative]
✖ found 2 problems, 1 warnings
ⓘ Get help: https://www.conventionalcommits.org/en/v1.0.0/#specification[COMMIT_EDITMSG]
BasedOnStyles = Vale, Commits, Conventional, Houseextends: conditional
message: "A '!' in the subject needs a 'BREAKING CHANGE:' trailer."
level: error
scope: subject
first: '^\w+(?:\([^)]*\))?!:'
second: '^BREAKING CHANGE: '
in: trailer