File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change
1
+ repos :
2
+ - repo : https://github.com/pre-commit/pre-commit-hooks
3
+ rev : v5.0.0
4
+ hooks :
5
+ - id : trailing-whitespace
6
+ - id : end-of-file-fixer
7
+ - id : check-added-large-files
8
+
9
+ - repo : https://github.com/astral-sh/ruff-pre-commit
10
+ rev : v0.12.1
11
+ hooks :
12
+ - id : ruff
13
+ args : ["check", "crudadmin", "--fix"]
14
+ - id : ruff-format
15
+ args : ["crudadmin"]
16
+
17
+ - repo : https://github.com/pre-commit/mirrors-mypy
18
+ rev : v1.16.1
19
+ hooks :
20
+ - id : mypy
21
+ args : ["crudadmin", "--strict"]
Original file line number Diff line number Diff line change @@ -49,6 +49,31 @@ CRUDAdmin uses pytest for testing. Run tests using:
49
49
uv run pytest
50
50
```
51
51
52
+ ### Pre-commit Hooks
53
+ CRUDAdmin uses pre-commit to automatically check code quality before each commit. It helps enforce
54
+ linting, formatting, and type checking.
55
+
56
+ After installing the development dependencies:
57
+
58
+ ``` sh
59
+ uv run pre-commit install
60
+ ```
61
+
62
+ This will set up thee Git hooks to run automatically before every commit.
63
+
64
+ * Running hooks Manually*
65
+ To run all hooks on all files:
66
+ ``` sh
67
+ uv run pre-commit run --all-files
68
+ ```
69
+
70
+ This will run:
71
+ - ` ruff ` fot linting and formatting
72
+ - ` mypy ` for type checking
73
+ - basic formatting checks (trailing whitespace, EOF, file size)
74
+
75
+ Make sure all pre-commit checks pass before submitting a PR.
76
+
52
77
### Linting
53
78
Use mypy for type checking:
54
79
``` sh
Original file line number Diff line number Diff line change @@ -89,7 +89,8 @@ dev = [
89
89
" httptools>=0.6.4" ,
90
90
" httpx>=0.28.1" ,
91
91
" sqlalchemy[mypy]>=2.0.36" ,
92
- " sqlalchemy-utils>=0.41.2"
92
+ " sqlalchemy-utils>=0.41.2" ,
93
+ " pre-commit>=3.5.0"
93
94
]
94
95
95
96
docs = [
You can’t perform that action at this time.
0 commit comments