forked from robocurve/inspect-robots
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
58 lines (53 loc) · 1.9 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
58 lines (53 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Pre-commit hooks for Inspect Robots. Install once per clone:
#
# uv run pre-commit install # sets up both pre-commit and pre-push hooks
#
# On commit: file hygiene + ruff (lint & format) + mypy (strict).
# On push: pytest with the 100% coverage gate.
#
# Run everything manually with: uv run pre-commit run --all-files
#
# The ruff / mypy / pytest hooks are "local" so they use the exact versions
# pinned in this project's dev environment (matching CI) rather than a separate
# pinned copy.
default_install_hook_types: [pre-commit, pre-push]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
exclude: ^website/package-lock\.json$ # npm lockfile, legitimately large
# Local hooks run through `uv run` so they use this project's dev environment
# (matching CI) regardless of whether a virtualenv is activated. Requires uv.
- repo: local
hooks:
- id: ruff-check
name: ruff (lint, autofix)
entry: uv run --extra dev ruff check --fix
language: system
types_or: [python, pyi]
require_serial: true
- id: ruff-format
name: ruff (format)
entry: uv run --extra dev ruff format
language: system
types_or: [python, pyi]
require_serial: true
- id: mypy
name: mypy (strict)
entry: uv run --extra dev mypy
language: system
types: [python]
pass_filenames: false
- id: pytest-coverage
name: pytest (100% coverage gate)
entry: uv run --extra dev pytest --cov --cov-report=term-missing
language: system
always_run: true # run on every push, even when no .py files changed
pass_filenames: false
stages: [pre-push]