Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
49 lines (47 loc) · 1.99 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
49 lines (47 loc) · 1.99 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
# Ruff runs in pre-commit's own environment, installed from the same version
# range as constraints/ci.txt (a test keeps them equal), so a commit that
# passes here passes the CI lint job's ruff steps whatever shell, IDE or Git
# client makes it. Install with `python dev.py setup`, or `pre-commit install`
# (both the pre-commit and pre-push stages are installed).
default_install_hook_types: [pre-commit, pre-push]
repos:
- repo: local
hooks:
- id: ruff-format
name: ruff format
entry: ruff format
language: python
additional_dependencies: ["ruff>=0.1,<0.16"]
types_or: [python, pyi]
files: ^(src/|tests/|dev\.py$) # what CI formats
- id: ruff
name: ruff check --fix
entry: ruff check --fix
language: python
additional_dependencies: ["ruff>=0.1,<0.16"]
types_or: [python, pyi]
files: ^(src/|tests/|dev\.py$) # what CI lints
# Before a push, the rest of the CI lint job: mypy, import contracts,
# EARS lint and the points index. It needs the dev environment, so it
# runs with the `python` your shell or Git client finds; push from the
# activated environment.
- id: dev-lint
name: python dev.py lint
entry: python dev.py lint
language: system
pass_filenames: false
always_run: true
stages: [pre-push]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Byte-exact files (golden snapshots, recorded fixtures, rendered
# images) must keep their bytes: rewriting whitespace breaks the golden
# tests, so only the two rewriting hooks skip them.
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md] # two trailing spaces are a <br>
exclude: &byte_exact ^(tests/golden/snapshots/|tests/fixtures/|sample_sessions/|docs/ter4/img/|docs/examples/)
- id: end-of-file-fixer
exclude: *byte_exact
- id: check-yaml
- id: check-added-large-files