Skip to content

Commit

Permalink
chore: add pre-commit framework to automatically check code before …
Browse files Browse the repository at this point in the history
…committing
  • Loading branch information
oliversen committed Apr 29, 2024
1 parent 717b3f2 commit 3cf11f4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[general]
contrib = contrib-title-conventional-commits
ignore = body-is-missing

[contrib-title-conventional-commits]
types = fix,feat,chore,docs,style,refactor,perf,test,revert,ci,build

[title-max-length]
line-length = 120
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
default_install_hook_types:
- pre-commit
- commit-msg

default_stages:
- pre-commit

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: no-commit-to-branch
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-pyproject
- flake8-import-order
- flake8-builtins
- flake8-annotations
- flake8-quotes
- flake8-simplify
- flake8-bugbear
- repo: http://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
args: [--check]
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ flake8-quotes==3.4.0
flake8-simplify==0.21.0
flake8-bugbear==24.4.26
isort==5.13.2
black==24.4.1
black==24.4.1
pre-commit==3.7.0

0 comments on commit 3cf11f4

Please sign in to comment.