Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
48 lines (44 loc) · 1.58 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
48 lines (44 loc) · 1.58 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
# Local git hooks, managed by prek (https://github.com/j178/prek) - a fast, Rust,
# no-Python reimplementation of pre-commit. Enable once with: prek install
#
# Mirrors CI where it's cheap: typos + Conventional Commits on commit, rustfmt on the
# staged Rust files, and clippy on push (too heavy per commit). Rust hooks only fire when
# Rust files change (types: [rust]).
default_install_hook_types: [pre-commit, commit-msg, pre-push]
repos:
- repo: https://github.com/crate-ci/typos
rev: v1.49.0
hooks:
- id: typos
stages: [pre-commit]
- repo: https://github.com/crate-ci/committed
rev: v1.1.11
hooks:
# Per-commit: lint the message as it is written.
- id: committed
stages: [commit-msg]
# Pre-push: lint every commit about to be pushed (mirrors CI's range check),
# so a subject that slipped past commit-msg (an --amend, a --no-verify) is
# caught before it reaches CI. Reuses the same managed committed binary.
- id: committed
alias: committed-range
name: committed (whole push range)
stages: [pre-push]
always_run: true
pass_filenames: false
args: [origin/main..HEAD]
- repo: local
hooks:
- id: rustfmt
name: rustfmt
entry: rustfmt --edition 2024
language: system
types: [rust]
stages: [pre-commit]
- id: cargo-clippy
name: cargo clippy
entry: cargo clippy --all-targets --all-features --locked -- -D warnings
language: system
types: [rust]
pass_filenames: false
stages: [pre-push]