forked from max-sixty/worktrunk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
83 lines (82 loc) · 3.18 KB
/
.pre-commit-config.yaml
File metadata and controls
83 lines (82 loc) · 3.18 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: end-of-file-fixer
exclude: '.*\.snap$'
- id: check-yaml
- id: mixed-line-ending
- id: trailing-whitespace
# rustfmt handles rust files, and in snapshots we expect trailing spaces.
exclude: '.*\.(rs|snap)$'
# pre-commit autoupdate reverts to mutable v1 tag; update manually
- repo: https://github.com/crate-ci/typos
rev: v1.41.0
hooks:
- id: typos
# https://github.com/crate-ci/typos/issues/347
pass_filenames: false
- repo: https://github.com/r0x0d/pre-commit-rust
rev: v1.0.1
hooks:
- id: fmt
- repo: https://github.com/r0x0d/pre-commit-rust
rev: v1.0.1
hooks:
- id: clippy
args: ["--all-targets", "--all-features", "--", "-D", "warnings"]
- repo: https://github.com/lycheeverse/lychee
rev: lychee-v0.22.0
hooks:
# Check links using .config/lychee.toml exclusions
# Uses lychee-system (requires `cargo install lychee`) to avoid /bin/bash dependency on Windows
- id: lychee-system
types: [markdown]
args:
- --config=.config/lychee.toml
- repo: local
hooks:
- id: cargo-lock
name: cargo-lock
description: Ensure Cargo.lock is in sync with Cargo.toml
language: system
entry: cargo check --locked
pass_filenames: false
files: (Cargo\.toml|Cargo\.lock)$
- id: no-dbg
name: no-dbg
description: We shouldn't merge code with `dbg!` in
language: pygrep
types: ["rust"]
entry: "dbg!"
- id: no-manual-ansi
name: no-manual-ansi
description: Use anstyle/osc8/strip-ansi-escapes instead of manual ANSI codes
language: pygrep
types: ["rust"]
entry: '\\x1b\['
# format.rs strips ANSI codes injected by wrap_ansi crate
# select.rs tests verify ANSI dimming behavior
exclude: '^(tests/|.*_test\.rs$|src/styling/(mod|format)\.rs$|src/commands/select/)'
- id: no-std-canonicalize-in-tests
name: no-std-canonicalize-in-tests
description: Use dunce::canonicalize in tests to avoid Windows \\?\ prefix issues
language: pygrep
entry: '\.canonicalize\(\)'
files: '^tests/'
- id: no-direct-cmd-output
name: no-direct-cmd-output
description: Use shell_exec::Cmd instead of cmd.output() for consistent logging
language: pygrep
types: ["rust"]
entry: '\.output\(\)'
# shell_exec.rs: defines Cmd which legitimately calls .output()
# select.rs: skim API's selected.output() is not Command::output()
# tests/benches: test utilities run commands directly
# src/config/{test,expansion,mod,user}.rs: TestRepo test fixtures use git init directly
exclude: '^(src/shell_exec\.rs|src/commands/select/|src/config/(test|expansion|mod|user)\.rs|tests/|benches/)'
ci:
# pre-commit.ci doesn't have Rust toolchain, so skip Rust-specific hooks.
# Network access also isn't supported, so skip lychee-system.
skip: [fmt, clippy, lychee-system, cargo-lock]
autoupdate_commit_msg: "chore: pre-commit autoupdate"