Skip to content

A pre-commit hook that checks commit messages for Conventional Commits formatting

License

Notifications You must be signed in to change notification settings

qustodio/conventional-pre-commit

 
 

Repository files navigation

QUSTODIO conventional-pre-commit

A pre-commit hook to check commit messages for Conventional Commits formatting.

Forked from https://github.com/compilerla/conventional-pre-commit

  • Warns the user instead of failing
  • Ignore default merge commit messages
  • Ignore default revert commit messages
  • Ignore default git flow Bump version messages

Usage

Make sure pre-commit is installed.

Create a blank configuration file at the root of your repo, if needed:

touch .pre-commit-config.yaml

Add a new repo entry to your configuration file:

repos:

# - repo: ...

  - repo: https://github.com/qustodio/conventional-pre-commit
    rev: <git sha or tag>
    hooks:
      - id: conventional-pre-commit
        stages: [commit-msg]
        args: [] # optional: list of Conventional Commits types to allow

Install the pre-commit script:

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

Actual qustodio version: v1.2.0-Qustodio

This tag differs from the orginal repo v1.2.0 in the following points

  • Warns about a non-conventional commit beeing made instead of failing
  • Ignores commit messages if they start with "Merged in " or "This reverts commit " in order to ignore merges or reverts

Developing for this repo

There are two main files to modify:

  • conventional-pre-commit.sh is the script that is executed in order to validate a commit message, it receives a commit message file as input and an array of arguments that specify the commit types to use.
  • tests.sh is the script that test this repo.

License

Apache 2.0

Inspired by matthorgan's pre-commit-conventional-commits.

About

A pre-commit hook that checks commit messages for Conventional Commits formatting

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%