Skip to content

Commit 34a2c77

Browse files
authored
Small improvements to pre-commit hooks (#1954)
* chore: set default pre-commit install hooks Signed-off-by: Luiz Georg <luiz.georg@profusion.mobi> * chore: update pre-commit hooks Signed-off-by: Luiz Georg <luiz.georg@profusion.mobi> * chore: limit frontend pre-commit hooks to frontend changes Signed-off-by: Luiz Georg <luiz.georg@profusion.mobi> --------- Signed-off-by: Luiz Georg <luiz.georg@profusion.mobi>
1 parent 92ffe09 commit 34a2c77

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

.pre-commit-config.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1+
default_install_hook_types:
2+
- pre-commit
3+
- pre-push
4+
- commit-msg
5+
16
repos:
27
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.15.9
8+
rev: v0.15.18
49
hooks:
510
- id: ruff-format
611
files: ^backend/
712
args: [--check]
13+
stages: [pre-commit]
14+
815
- id: ruff-check
916
files: ^backend/
17+
stages: [pre-commit]
1018

1119
- repo: local
1220
hooks:
@@ -15,13 +23,15 @@ repos:
1523
entry: bash -lc 'cd dashboard && pnpm lint-staged'
1624
language: system
1725
pass_filenames: false
26+
files: ^dashboard/
1827
stages: [pre-commit]
1928

2029
- id: frontend-typecheck
2130
name: frontend typecheck
2231
entry: bash -lc 'cd dashboard && pnpm typecheck'
2332
language: system
2433
pass_filenames: false
34+
files: ^dashboard/
2535
stages: [pre-commit]
2636

2737
- id: frontend-pre-push

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ You can find more details on the Conventional Commits specification site.
103103
- Auto-fix lint issues: `poetry run ruff check . --fix`
104104
- Run type checks (optional but recommended): `poetry run mypy`
105105
- Run tests: `poetry run pytest`
106-
- Install Git hooks once per clone: from the repository root run `poetry -C backend run pre-commit install --hook-type pre-commit --hook-type pre-push --hook-type commit-msg --install-hooks`
106+
- Install Git hooks once per clone: from the repository root run `poetry -C backend run pre-commit install --install-hooks`
107107
- Run all hooks manually: `poetry -C backend run pre-commit run --all-files`
108108
- Frontend
109109
- See [dashboard/README.md](dashboard/README.md) for scripts and commands

backend/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The backend uses Ruff for linting and formatting.
112112
This repository uses pre-commit for Git hooks (`pre-commit` and `pre-push`). Install hooks once per clone from the repository root:
113113
114114
```sh
115-
poetry -C backend run pre-commit install --hook-type pre-commit --hook-type pre-push --hook-type commit-msg --install-hooks
115+
poetry -C backend run pre-commit install --install-hooks
116116
```
117117
118118
To run all configured hooks manually:

0 commit comments

Comments
 (0)