mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 07:17:27 +00:00
[Crate] Add clippy and rustfmt pre-commit hooks (#50)
These hooks can be installed using [pre-commit], with: "pre-commit install". Once installed they will prevent you from committing if the staged code has clippy warnings or hasn't been formatted. You can skip the pre-commit checks by adding the "-n" flag to your git commit command. The hooks also require rustup as the nightly versions of rustfmt and clippy are used. [pre-commit]: https://pre-commit.com/
This commit is contained in:
parent
31162b6d6e
commit
89fbd81331
1 changed files with 17 additions and 0 deletions
17
.pre-commit-config.yaml
Normal file
17
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: clippy
|
||||
name: Check clippy
|
||||
language: system
|
||||
files: '[.]rs$'
|
||||
pass_filenames: false
|
||||
entry: rustup run --install nightly cargo-clippy -- -- -D warnings
|
||||
- id: format
|
||||
name: Check rustfmt
|
||||
language: system
|
||||
files: '[.]rs$'
|
||||
pass_filenames: false
|
||||
entry: rustup run --install nightly cargo-fmt --check
|
||||
Loading…
Add table
Add a link
Reference in a new issue