Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
default_install_hook_types: [pre-commit, commit-msg]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
Expand Down Expand Up @@ -46,6 +48,23 @@ repos:
- id: ruff-format
types_or: [python, pyi]

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args:
- feat
- fix
- docs
- test
- refactor
- perf
- chore
- ci
- build
- revert

- repo: local
hooks:
- id: hatch-mypy
Expand Down
13 changes: 7 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,21 @@ git push origin feat/<short-description>

### Pre-commit Hook (Recommended)

To ensure quality checks run automatically before each commit, install the pre-commit hook that runs both linting and mypy type checking:
To ensure quality checks run automatically before each commit, install the pre-commit hooks that run linting, mypy type checking, and commit message validation:

```bash
# Install the pre-commit hook (run once after cloning)
# Install pre-commit hooks (run once after cloning)
hatch run lint:install-hooks

# The hook automatically runs a selection of linters before each commit.
# The hooks automatically run linters before each commit and validate
# that commit messages follow Conventional Commits format.

# If the hook fails, it will prevent the commit and show helpful messages
# You can fix some issues automatically with:
# If a hook fails, it will prevent the commit and show helpful messages.
# You can fix formatting issues automatically with:
hatch run lint:fix
```

The pre-commit hook prevents commits that would fail some CI quality checks, saving time and ensuring consistent code quality.
The pre-commit hooks prevent commits that would fail CI quality checks, and enforce that all commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/) format documented in the [Commit Guidelines](#commit-guidelines) section.

---

Expand Down
Loading