You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-7Lines changed: 34 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -251,19 +251,49 @@ Pre-commit runs automatically on `git commit` and will block commits if checks f
251
251
252
252
---
253
253
254
+
### ⚠️ Important: Where to run pre-commit
255
+
256
+
**Pre-commit must always be run from the repository root.**
257
+
258
+
Some hooks (notably `mypy`) reference configuration files using paths relative to the repo root (for example, `backend/pyproject.toml`). Running pre-commit from a subdirectory such as `backend/` can cause those configurations to be missed, leading to inconsistent or misleading results.
259
+
260
+
✅ Correct:
261
+
262
+
```bash
263
+
pre-commit run --all-files
264
+
```
265
+
266
+
❌ Incorrect:
267
+
268
+
```bash
269
+
cd backend
270
+
pre-commit run --all-files
271
+
```
272
+
273
+
In CI, pre-commit is also executed from the repository root for this reason.
274
+
275
+
> **Note:** When using `uv`, CI runs pre-commit via
276
+
> `uv run --project backend pre-commit run --all-files`.
277
+
> The `--project` flag selects the backend virtual environment, but **does not change the working directory**. Pre-commit itself must still be invoked from the repo root so configuration paths resolve correctly.
278
+
279
+
---
280
+
254
281
### What pre-commit checks
255
282
256
283
-**Backend**
284
+
257
285
- Ruff linting and formatting
258
-
- Python style and correctness checks
286
+
- Python style and correctness checks (mypy)
287
+
259
288
-**Frontend**
289
+
260
290
- ESLint (auto-fix on staged files)
261
291
- Prettier formatting (staged files only)
262
292
263
293
All hooks are configured in the root `.pre-commit-config.yaml`.
264
294
265
-
> **Note:** Git hooks run in a non-interactive shell
266
-
> Make sure that Node.js tools (such as `pnpm`) are available in your system `PATH` so pre-commit hooks can execute successfully.
295
+
> **Note:** Git hooks run in a non-interactive shell.
296
+
> Make sure that Node.js tools (such as `pnpm`) are available in your system `PATH` so frontend hooks can execute successfully.
267
297
268
298
---
269
299
@@ -293,7 +323,7 @@ make pre-commit-install
293
323
294
324
### Running pre-commit manually
295
325
296
-
To run all hooks against all files:
326
+
To run all hooks against all files (from the repo root):
297
327
298
328
```bash
299
329
make pre-commit-run
@@ -302,12 +332,9 @@ make pre-commit-run
302
332
Or directly:
303
333
304
334
```bash
305
-
cd backend
306
335
uv run pre-commit run --all-files
307
336
```
308
337
309
-
You can also run pre-commit from **any directory inside the repo**; it always resolves the repo root configuration.
0 commit comments