CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

trysac/commit-msg-lint

Check and fix commit messages against Conventional Commits 1.0.0 with ten rules (C001-C010) and safe auto-fix suggestions. Use when the user asks to write, review or validate a commit message, or to set up commit message rules.

Quality

95%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files
name:
commit-msg-lint
description:
Check and fix commit messages against Conventional Commits 1.0.0 with ten rules (C001-C010) and safe auto-fix suggestions. Use when the user asks to write, review or validate a commit message, or to set up commit message rules.

commit-msg-lint

Validate a commit message against Conventional Commits 1.0.0 and get a corrected version when a safe fix exists. Works on a file or on text, with Python 3.10+ and nothing to install.

When to use

  • Before running git commit, to check the message you are about to write.
  • When reviewing commits that "do not look right" (wrong type, trailing period, missing blank line).
  • When the user wants a project convention for types and scopes, or help wiring their own commit-msg hook (see references/hook.md).

Workflow

  1. Draft the message as type(scope)!: description, then optional body and footers.

  2. Lint it:

    python3 scripts/commit_lint.py --message "feat(api): add v2 endpoint"
    python3 scripts/commit_lint.py .git/COMMIT_EDITMSG
  3. Read the findings (C00x name: message (line N)). If a suggestion: is printed, it already lints clean; use it. Otherwise fix the cause named by the rule (references/rules.md).

  4. For a message in a file, --fix rewrites it only when the suggestion lints clean.

  5. Re-lint and only then commit.

Project conventions can be passed as options:

python3 scripts/commit_lint.py msg.txt --types feat,fix,docs --scopes api,cli --require-scope --max-header 72

Exit codes

CodeMeaning
0Clean (or fixed with --fix)
1Findings were printed
2Usage error, unreadable file, invalid UTF-8, or input over 65,536 bytes

Rules at a glance

IdMeaning
C001Header is not type(scope)!: description
C002Type not in the allowed list
C003Type is not lowercase
C004Header longer than the maximum (default 72 characters)
C005Description ends with a period
C006Empty scope ()
C007No blank line after the header
C008Breaking-change footer misspelt (must be BREAKING CHANGE or BREAKING-CHANGE)
C009Scope not in the allowed scopes (only when scopes are configured)
C010Scope required but missing (only with --require-scope)

Default types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert. Details and examples: references/rules.md.

Behaviour to know

  • Git comment lines (starting with #) and everything after the scissors line are ignored, like git does.
  • Merge commits, Revert "...", fixup! and squash! headers are skipped unless --no-ignore-merges is given.
  • Suggestions apply only: alias to type (feature to feat, bugfix/fixes to fix, doc to docs, tests to test) and lowercase, a missing space after the colon, one trailing period removed, and a blank line after the header. Anything else (for example an unknown type, a long header, a wrong scope) is left for the author, because choosing it needs judgement.
  • The suggestion is built from the cleaned message, so git comment lines are not carried into it.
Workspace
trysac
Visibility
Public
Created
Last updated
Source
CLI
Repository
No repository linked. Set repository in the plugin manifest, or publish from a GitHub Action to verify it.
Badge
trysac/commit-msg-lint badge