-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprek.toml
More file actions
115 lines (103 loc) · 3.92 KB
/
Copy pathprek.toml
File metadata and controls
115 lines (103 loc) · 3.92 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
default_install_hook_types = ["pre-commit", "commit-msg"]
[[repos]]
repo = "builtin"
hooks = [
{ id = "check-added-large-files" },
{ id = "check-merge-conflict" },
{ id = "check-toml" },
{ id = "check-yaml" },
{ id = "check-json" },
{ id = "end-of-file-fixer", exclude_types = ["rust"] },
{ id = "mixed-line-ending" },
{ id = "trailing-whitespace", exclude = "^tests/(snapshots/.*\\.snap|fixtures/.*)$" },
]
[[repos]]
repo = "https://github.com/alessandrojcm/commitlint-pre-commit-hook"
rev = "v9.21.0"
[[repos.hooks]]
id = "commitlint"
stages = ["commit-msg"]
additional_dependencies = ["@commitlint/config-conventional"]
# Enforces the 120-character ceiling from AGENTS.md's Style section. It
# cannot judge whether a break under that ceiling is semantic or columnar —
# that half of the convention is a review concern, not a lint one.
#
# Scoped to the docs this convention actually covers — the same set
# `mise run lint:md` checks: docs/, the agent skill (a second, independent
# CLI description — see AGENTS.md's "When you touch..."), and this file.
# Left unscoped it also reaches CHANGELOG.md (git-cliff's output, not ours
# to reformat) and README.md (not part of this convention).
[[repos]]
repo = "https://github.com/DavidAnson/markdownlint-cli2"
rev = "v0.23.2"
hooks = [
{ id = "markdownlint-cli2", files = "^(docs/.*\\.md|skills/.*\\.md|AGENTS\\.md)$" },
]
[[repos]]
repo = "local"
# Suppressions are configured in .github/actionlint.yml, not here: the same
# file serves `mise run lint:actions`, so the two cannot disagree.
[[repos.hooks]]
id = "actionlint"
name = "actionlint"
language = "system"
entry = "actionlint"
files = "^\\.github/workflows/.*\\.ya?ml$"
[[repos.hooks]]
id = "typos"
name = "typos"
language = "system"
entry = "typos"
pass_filenames = false
[[repos.hooks]]
id = "fmt"
name = "cargo fmt"
language = "system"
entry = "cargo fmt --all -- --check"
files = "\\.rs$"
pass_filenames = false
[[repos.hooks]]
id = "clippy"
name = "cargo clippy"
language = "system"
entry = "cargo clippy --all-targets --all-features -- -D warnings"
files = "\\.rs$"
pass_filenames = false
# The Git backend is replaceable only for as long as `git2` types never reach
# the domain (ADR-011). The `GitBackend` trait alone does not enforce that: one
# `use git2::Oid` in render.rs and the abstraction is decorative, with nothing
# failing until someone actually attempts the swap years later. This is the
# enforcement.
#
# The lookbehind is load-bearing: a plain `git2::` also matches `libgit2::`,
# which every module legitimately names when it constructs a backend, and the
# hook would have failed on day one for the wrong reason.
[[repos.hooks]]
id = "git-backend-isolation"
name = "git2 is confined to the libgit2 backend"
language = "system"
entry = "bash -c '! grep -rnP --include=*.rs \"(?<![A-Za-z0-9_])git2::\" src | grep -v \"^src/git/libgit2\\.rs:\"'"
files = "\\.rs$"
pass_filenames = false
# Invariant 5 was vacuously true until remote data sources landed: there was no
# HTTP client to confine. Now there is, and "network access exists only in
# `src/data/`" needs the same enforcement the Git backend has — a `use ureq` in
# render.rs would make a template's content able to reach the network, which is
# the one thing the renderer must never be able to do.
[[repos.hooks]]
id = "http-isolation"
name = "the HTTP client is confined to the data layer"
language = "system"
entry = "bash -c '! grep -rnP --include=*.rs \"(?<![A-Za-z0-9_])ureq::\" src | grep -v \"^src/data/\"'"
files = "\\.rs$"
pass_filenames = false
# .pre-commit-hooks.yaml is a public contract once tagged (consumers pin it
# with `rev:`) — validated here so a mistake is caught before a release tags
# it, not by the first consumer to run it.
[[repos.hooks]]
id = "validate-pre-commit-hooks-manifest"
name = "validate .pre-commit-hooks.yaml"
language = "system"
entry = "prek validate-manifest .pre-commit-hooks.yaml"
files = "^\\.pre-commit-hooks\\.yaml$"
pass_filenames = false