/msglint

Checks your commit messages.

Primary LanguageRust

msglint

Checks your commit messages.

Installation

Install from source

git clone https://github.com/aspizu/msglint
cd msglint
cargo install --path .

Instal from source (using cargo)

cargo install --git https://github.com/aspizu/msglint

Usage

Install the git hook into your repository

Note

You will have to do this for every repository.

msglint --install

Test a commit message from a file

msglint commit-message.txt

Uninstall the git hook from a repository

rm .git/hooks/commit-msg

Integration

pre-commit

It's recommended to not use pre-commit to handle msglint. If you don't already have pre-commit hooks that run on commit-msg, don't install pre-commit into commit-msg. Just install msglint directly into commit-msg. Additionally, colored output will not work when used with pre-commit.

First, specify the commit-msg hook to be installed by default when you do pre-commit install in .pre-commit-config.yaml.

default_install_hook_types: [pre-commit, commit-msg]

Install pre-commit into the commit-msg hook.

pre-commit install --hook-type commit-msg

Add the msglint hook to .pre-commit-config.yaml.

repos:
    - repo: local
      hooks:
          - id: msglint
            name: msglint
            language: system
            entry: msglint
            stages: [commit-msg]