Skip to content

Commit e655cd0

Browse files
committed
rust-check: run cargo check
1 parent d758d67 commit e655cd0

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

.pre-commit-hooks.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@
6666
language: golang
6767
pass_filenames: false
6868

69+
- id: rust-check
70+
name: 'Run cargo check'
71+
entry: run-rust-check.sh
72+
language: 'script'
73+
files: Cargo\.toml|\.rs$
74+
pass_filenames: false
75+
minimum_pre_commit_version: 0.15.0
76+
description: 'Run cargo check against all features & targets'
77+
6978
- id: rust-clippy
7079
name: 'Run clippy lints'
7180
entry: run-rust-clippy.sh
@@ -79,7 +88,7 @@
7988
name: 'Cargo tests'
8089
entry: run-rust-tests.sh
8190
language: 'script'
82-
files: \.rs$
91+
files: Cargo\.toml|\.rs$
8392
pass_filenames: false
8493
minimum_pre_commit_version: 0.15.0
8594
description: 'Run cargo test in the repo root'

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Hooks:
1212
* `go-golangci-lint`: a copy of the [official lint
1313
config](https://github.com/golangci/golangci-lint/commit/09677d574ea6cd05141022aa90b88b6598bfa1a1)
1414
without forcing the `--fix` argument
15+
* `rust-check`: runs `cargo check` lints against all features & targets
1516
* `rust-clippy`: runs `cargo clippy` lints in the repo root
1617
* `rust-test`: runs `cargo test` at the repo root, includes all targets/features/examples/benches
1718
* `r-stylr`: runs [`stylr`] to format R code
@@ -58,6 +59,9 @@ repos:
5859
types: [go]
5960
exclude: \.pb.go$
6061

62+
- id: rust-check
63+
stages: [commit, push]
64+
6165
- id: rust-clippy
6266
#args: [ # Optionally override default configured lints
6367
# "-D rust_2018_idioms",

run-rust-check.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
cargo check --all-targets --all-features --workspace "$@"

0 commit comments

Comments
 (0)