Skip to content

Commit

Permalink
rust-check: run cargo check
Browse files Browse the repository at this point in the history
  • Loading branch information
domodwyer committed Dec 12, 2020
1 parent d758d67 commit e655cd0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@
language: golang
pass_filenames: false

- id: rust-check
name: 'Run cargo check'
entry: run-rust-check.sh
language: 'script'
files: Cargo\.toml|\.rs$
pass_filenames: false
minimum_pre_commit_version: 0.15.0
description: 'Run cargo check against all features & targets'

- id: rust-clippy
name: 'Run clippy lints'
entry: run-rust-clippy.sh
Expand All @@ -79,7 +88,7 @@
name: 'Cargo tests'
entry: run-rust-tests.sh
language: 'script'
files: \.rs$
files: Cargo\.toml|\.rs$
pass_filenames: false
minimum_pre_commit_version: 0.15.0
description: 'Run cargo test in the repo root'
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Hooks:
* `go-golangci-lint`: a copy of the [official lint
config](https://github.com/golangci/golangci-lint/commit/09677d574ea6cd05141022aa90b88b6598bfa1a1)
without forcing the `--fix` argument
* `rust-check`: runs `cargo check` lints against all features & targets
* `rust-clippy`: runs `cargo clippy` lints in the repo root
* `rust-test`: runs `cargo test` at the repo root, includes all targets/features/examples/benches
* `r-stylr`: runs [`stylr`] to format R code
Expand Down Expand Up @@ -58,6 +59,9 @@ repos:
types: [go]
exclude: \.pb.go$

- id: rust-check
stages: [commit, push]

- id: rust-clippy
#args: [ # Optionally override default configured lints
# "-D rust_2018_idioms",
Expand Down
5 changes: 5 additions & 0 deletions run-rust-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -euo pipefail

cargo check --all-targets --all-features --workspace "$@"

0 comments on commit e655cd0

Please sign in to comment.