commitlint
commitlint copied to clipboard
Permit merge commit messages
trafficstars
commitlint fails auto-generated merge-commit messages; these should be allowed.
daniel@cracked project_dir % git merge develop
→ input: "Merge branch 'develop'..."
Errors:
❌ parser: type: invalid character ' '
Total 1 errors, 0 warnings, 0 other severities
Not committing merge; use 'git commit' to complete the merge.
A proper solution would be to have a defaultIgnore + ignore rule as it exists here https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/is-ignored/src/defaults.ts
for now i have added this to my commit-msg file
#!/bin/sh
if ! type commitlint >/dev/null 2>/dev/null; then
echo ""
echo "commitlint could not be found"
echo "try again after installing commitlint or add commitlint to PATH"
echo ""
exit 2;
fi
commit_message_file=$(git rev-parse --git-dir)/COMMIT_EDITMSG
# Read the content of the commit message file
commit_message=$(cat "$commit_message_file")
# Check if the commit message starts with "merge"
if [[ "$commit_message" =~ ^merge ]]; then
# If it starts with "merge", exit without performing validation
exit 0
fi
commitlint lint --message $1
Yeap. That sounds like we need a whitelist.
I'd suggest a configurable list of regex with a default set that contains all those regex from conventional-changelog's implementation.