Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
95 lines (86 loc) · 3.52 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
95 lines (86 loc) · 3.52 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
# contrib/ holds standalone projects with checks of their own.
exclude: /thirdparty/|lore-server/src/protocol/test_data/|tps/|^contrib/
repos:
- repo: local
hooks:
- id: cargo-clippy
name: cargo clippy
language: rust
entry: ./.pre-commit-clippy.py
pass_filenames: false
always_run: true
- id: cargo-fmt
name: cargo format
language: rust
entry: cargo +nightly fmt --all --check
pass_filenames: false
always_run: true
# `.internal()` on an error set silently collapses every handleable
# variant into `Internal`, so `InternalForbiddenOnErrorSets` makes it an
# E0034 ambiguity. rustc's own help text then suggests disambiguating
# with `WrapInternal::internal(..)`, which compiles and reinstates the
# bug. The guard trait is uncallable by construction; this catches the
# one spelling the type system cannot.
- id: no-wrapinternal-ufcs
name: no UFCS bypass of the .internal() guard
language: system
# rg exits 0 when it finds a match, so invert it: a hit must fail.
# Matches the call form only, so the rustdoc link in ext.rs — which is
# `](WrapInternal::internal)`, no open paren after — is not a hit.
entry: >-
bash -c '! rg -n "\bWrapInternal::internal(_with)?\s*\("
--glob "*.rs" --glob "!target/**" --glob "!contrib/**" .
|| { echo "Use .forward()/.forward_any(), or Target::internal_with_context() to collapse deliberately."; exit 1; }'
pass_filenames: false
always_run: true
- repo: https://github.com/EmbarkStudios/cargo-deny
rev: 0.19.0
hooks:
- id: cargo-deny
args: [ "--all-features", "check", "bans", "licenses", "sources" ]
always_run: true
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: end-of-file-fixer
# We take the SWFS header as-is
exclude: ^lore-revision/src/fs/swfs/api_interface/generated/swfs.h$
- id: trailing-whitespace
# We take the SWFS header as-is
exclude: ^lore-revision/src/fs/swfs/api_interface/generated/swfs.h$
- id: check-executables-have-shebangs
# Ignore for now until executable flag handling is easier in Lore
# - id: check-shebang-scripts-are-executable
- id: mixed-line-ending
args: [ "--fix=lf" ]
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
- id: check-vcs-permalinks
- id: detect-private-key
- id: fix-byte-order-marker
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: remove-tabs
# lore-core/native uses clangformat, which expects to use tabs so leave that path alone
# We take the SWFS header as-is
exclude: (lore-core/native|^lore-revision/src/fs/swfs/api_interface/generated/swfs.h$)
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
require_serial: true
args: [ "--severity=info", "--external-sources" ]
exclude: ".envrc$"
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args: [ "-L", "ue,crate,numer,ser,ratatui,ect,noes,keep-alives", "-S", "Cargo.*,vendor/*" ]
exclude: ^(docs/developing/doc-standards/tools/vale/styles/|\.github/)
- repo: https://github.com/rhysd/actionlint
rev: v1.7.1
hooks:
- id: actionlint
files: ^\.github/workflows/