Skip to content

Various pre-commit hooks we found useful.

License

Notifications You must be signed in to change notification settings

MotivoZwolle/pre-commit-hooks

Repository files navigation

Motivo Pre-Commit hooks

A set of pre-commit hooks we found useful.

Description

This repository contains various pre-commit hooks we're just starting to collect.

License

MIT

Available pre-commit hooks

add-ticket-to-commit

  • Runs on: prepare-commit-msg

We use Jira for our ticket management, and our branches usually follow the feature/proj-103-short-description method. This command adds the commit message to the start of the commit.

The code is inspired on the work of Wiktor Malinowski's article "How To Prefix Your Commit Message With a Ticket Number Automatically", but with some changes to suit our programming style.

To install this, add the following to your repository's .pre-commit-config.yaml

repos:
  #
  - repo: https://github.com/motivozwolle/pre-commit-hooks
    hooks:
      - id: add-ticket-to-commit

shellcheck

  • Runs on: commit

Checks the bash scripts in the repository against shellcheck for common errors.

To install this, add the following to your repository's .pre-commit-config.yaml

repos:
  #
  - repo: https://github.com/motivozwolle/pre-commit-hooks
    hooks:
      - id: shellcheck