Last active
May 29, 2024 14:00
-
-
Save ziteh/d725d7fbdbf16716ab7fb9c0a4a06c55 to your computer and use it in GitHub Desktop.
Git Hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gitlint: Linting for your git commit messages | |
# $ pre-commit install --hook-type commit-msg | |
# https://jorisroovers.com/gitlint/latest/rules/ | |
[general] | |
# Ignore rules, reference them by id or name (comma-separated) | |
ignore=body-is-missing | |
# Enable specific community contributed rules | |
contrib=contrib-title-conventional-commits | |
### Configuring rules ### | |
[title-max-length] | |
line-length=72 | |
[title-min-length] | |
min-length=5 | |
[contrib-title-conventional-commits] | |
types=fix,feat,chore,docs,style,refactor,perf,test | |
# fix: patches a bug (this correlates with PATCH in Semantic Versioning) | |
# feat: introduces a new feature (this correlates with MINOR in Semantic Versioning) | |
# refactor: a code change that neither fixes a bug nor adds a feature | |
# style: changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) | |
# perf: performance improvements | |
# test: adding missing tests or correcting existing tests | |
# chore: changes that do not relate to a fix or feature and don't modify src or test files (for example updating dependencies) | |
# docs: documentation only changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repos: | |
# Basic, https://pre-commit.com/hooks.html | |
- repo: 'https://github.com/pre-commit/pre-commit-hooks' | |
rev: v4.5.0 | |
hooks: | |
- id: check-json | |
- id: check-yaml | |
- id: check-toml | |
- id: check-xml | |
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline | |
- id: trailing-whitespace # trims trailing whitespace | |
- id: mixed-line-ending # replaces or checks mixed line ending | |
- id: detect-private-key # detects the presence of private keys | |
- id: check-added-large-files # prevents giant files from being committed | |
args: ['--maxkb=500'] | |
# Git commit message lint | |
- repo: 'https://github.com/jorisroovers/gitlint' | |
rev: v0.19.1 | |
hooks: | |
- id: gitlint |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment