Repository navigation
Expand file tree
/
Copy pathprek.toml
More file actions
100 lines (91 loc) · 3.5 KB
/
Copy pathprek.toml
File metadata and controls
100 lines (91 loc) · 3.5 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
# Configuration file for `prek`, a fast Git hook manager written in Rust.
# See https://prek.j178.dev for more information.
#:schema https://www.schemastore.org/prek.json
# Built-in hooks run natively in Rust — no repo clone, no Python venv, works offline.
[[repos]]
repo = "builtin"
hooks = [
{ id = "trailing-whitespace" },
{ id = "end-of-file-fixer" },
{ id = "check-yaml" },
{ id = "check-toml" },
{ id = "check-merge-conflict" },
# Design masters are hand-authored sources, not build output: a 1024² icon
# layer is legitimately over the 500 KB default. The guard still covers
# everything else, which is where an accidental blob would land.
{ id = "check-added-large-files", exclude = "^design/" },
]
[[repos]]
repo = "https://github.com/crate-ci/typos"
rev = "v1.49.0"
hooks = [
{ id = "typos", args = ["--config", ".config/typos.toml", "--write-changes", "--force-exclude"] },
]
[[repos]]
repo = "local"
[[repos.hooks]]
id = "cargo-fmt"
name = "cargo fmt"
entry = "cargo fmt --all --"
language = "system"
types = ["rust"]
pass_filenames = false
# Single-source-of-truth guards stored with their owners: each names the module
# that owns a decision and fails on its ingredients anywhere else. The same
# rules as CI's `ast-grep` job, here over the staged Rust, TypeScript and YAML
# files (the last two for the guards over `.github`); ast-grep is in the devenv
# shell.
[[repos.hooks]]
id = "ast-grep"
name = "ast-grep"
entry = "ast-grep scan"
language = "system"
types_or = ["rust", "ts", "yaml"]
# Clippy compiles the workspace, so keep it on pre-push rather than every commit.
[[repos.hooks]]
id = "cargo-clippy"
name = "cargo clippy"
entry = "cargo clippy --workspace --all-targets -- -D warnings"
language = "system"
types = ["rust"]
pass_filenames = false
stages = ["pre-push"]
# A broken intra-doc link is neither a compile error nor a clippy lint, so rustdoc
# is the only step that catches one — and deleting or renaming an item silently
# orphans every link to it. Mirrors CI's `rustdoc (non-GUI crates)` job: the GPUI
# crates are excluded because documenting them drags in the graphics toolchain.
# `sh -c` because RUSTDOCFLAGS is an env var and hook entries are not shell strings.
[[repos.hooks]]
id = "cargo-rustdoc"
name = "cargo doc"
entry = "sh -c 'RUSTDOCFLAGS=\"-D warnings\" cargo doc --workspace --no-deps --document-private-items --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay --exclude openlogi-agent'"
language = "system"
types = ["rust"]
pass_filenames = false
stages = ["pre-push"]
# Shell scripts: shellcheck lints, shfmt formats. Both are in the devenv shell
# and in CI's `shell` job.
#
# shfmt's formatting options live in `.editorconfig`, and it discards that file
# entirely the moment a printer flag (`-i`, `-ci`, `-bn`, …) appears on the
# command line — so this entry, the CI job and the local runner all invoke it
# bare. Its `[[shell]]` section matches by shebang as well as by extension,
# which is what covers the extensionless `.agents/*` scripts.
#
# `types = ["shell"]` matches the same way. `.envrc` is excluded to keep this
# set identical to the one CI checks (`shfmt -f` over tracked files): direnv
# sources it, it carries no shebang, and shfmt does not consider it a script.
[[repos.hooks]]
id = "shellcheck"
name = "shellcheck"
entry = "shellcheck"
language = "system"
types = ["shell"]
exclude = "^\\.envrc$"
[[repos.hooks]]
id = "shfmt"
name = "shfmt"
entry = "shfmt --write"
language = "system"
types = ["shell"]
exclude = "^\\.envrc$"