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:
4949uv run pytest
5050```
5151
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+
5277### Linting
5378Use mypy for type checking:
5479``` sh
Original file line number Diff line number Diff line change @@ -89,7 +89,8 @@ dev = [
8989 " httptools>=0.6.4" ,
9090 " httpx>=0.28.1" ,
9191 " sqlalchemy[mypy]>=2.0.36" ,
92- " sqlalchemy-utils>=0.41.2"
92+ " sqlalchemy-utils>=0.41.2" ,
93+ " pre-commit>=3.5.0"
9394]
9495
9596docs = [
You can’t perform that action at this time.
0 commit comments