Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0bce0d2

Browse files
committedFeb 21, 2025
Add/update pre-commit hooks
1 parent 0f64682 commit 0bce0d2

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed
 

‎.github/workflows/pre-commit.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ jobs:
1313
check-merge-conflict,
1414
check-case-conflict,
1515
detect-private-key,
16+
mixed-line-ending,
17+
trailing-whitespace,
1618
cspell,
1719
typos,
18-
fmt,
19-
clippy,
20+
cargo-fmt,
21+
cargo-clippy,
2022
cargo-test,
2123
]
2224
steps:

‎.pre-commit-config.yaml

+27-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v2.3.0
7+
rev: v4.5.0
88
hooks:
99
- id: check-toml
1010
stages: [pre-commit]
@@ -16,33 +16,49 @@ repos:
1616
stages: [pre-commit]
1717
- id: detect-private-key
1818
stages: [pre-commit]
19+
- id: mixed-line-ending
20+
stages: [pre-commit]
21+
args: ["--fix=lf"]
22+
- id: trailing-whitespace
23+
stages: [pre-commit]
24+
args: [--markdown-linebreak-ext=md]
1925
- repo: https://github.com/crate-ci/committed
20-
rev: v1.0.1
26+
rev: v1.0.20
2127
hooks:
2228
- id: committed
2329
stages: [commit-msg]
2430
# cspell is dictionary based
2531
# Dictionary: A confidence rating is given for how close a word is to one in a dictionary
2632
- repo: https://github.com/streetsidesoftware/cspell-cli
27-
rev: v6.2.0
33+
rev: v8.3.0
2834
hooks:
2935
- id: cspell
3036
# typos is corrections based
3137
# Corrections: Known misspellings that map to their corresponding dictionary word
3238
- repo: https://github.com/crate-ci/typos
33-
rev: v1.13.12
39+
rev: v1.18.2
3440
hooks:
3541
- id: typos
42+
pass_filenames: false
3643
args: [] # this prevents typos from being autocorrected (so you have a chance to review them)
37-
- repo: https://github.com/doublify/pre-commit-rust
38-
rev: v1.0
39-
hooks:
40-
- id: fmt
41-
args: ["--check", "--"]
42-
- id: clippy
43-
args: ["--all-features", "--", "-D", "warnings", "-A", "unknown-lints"]
4444
- repo: local
4545
hooks:
46+
- id: cargo-fmt
47+
name: cargo fmt
48+
description: Run cargo fmt
49+
entry: cargo fmt
50+
language: system
51+
types: [rust]
52+
args: ["--"]
53+
require_serial: true
54+
- id: cargo-clippy
55+
name: cargo clippy
56+
description: Run cargo clippy
57+
entry: cargo clippy
58+
language: system
59+
types: [rust]
60+
pass_filenames: false
61+
args: ["--all-features", "--", "-D", "warnings", "-A", "unknown-lints"]
4662
- id: cargo-test
4763
name: cargo test
4864
description: Run cargo test

‎_typos.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# With a focus on spell checking source code, most text will be in the form of
22
# identifiers that are made up of words conjoined via snake_case, CamelCase,
3-
# etc. A typo at the word level might not be a typo as part of an identifier,
3+
# etc. A typo at the word level might not be a typo as part of an identifier,
44
# so identifiers get checked and, if not in a dictionary, will then be split
55
# into words to be checked.
66

@@ -13,7 +13,7 @@ files.extend-exclude = [
1313
[default.extend-identifiers]
1414

1515
# Words are split from identifiers on case changes as well as breaks in [a-zA-Z]
16-
# with a special case to handle acronyms. For example, First10HTMLTokens
16+
# with a special case to handle acronyms. For example, First10HTMLTokens
1717
# would be split as first, html, tokens.
1818
[default.extend-words]
1919

0 commit comments

Comments
 (0)