Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
language: system
types: [rust]
pass_filenames: false
- id: cargo-test
name: cargo test
description: Run tests
entry: cargo test
language: system
types: [rust]
pass_filenames: false
- id: clippy
name: clippy
description: Lint rust sources
Expand Down
38 changes: 27 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,38 @@

[Rust](https://www.rust-lang.org) tools package for [pre-commit](https://pre-commit.com).

## Using rust tools with pre-commit
## Usage

Install pre-commit:
`pip install pre-commit`

Create .pre-commit-config.yaml in your main project dir with the following content:
```yaml
- repo: https://github.com/doublify/pre-commit-rust
rev: master
hooks:
- id: fmt
- id: cargo-check
- repo: https://github.com/kajmaj87/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: clippy
- id: cargo-check
- id: cargo-test
```
Choose plugins and their order from the above list as needed.

Then run:

```
$ pre-commit install
$ pre-commit run --all-files
```

After that you it will be checked before each commit.

## Passing arguments to rustfmt

```yaml
- repo: https://github.com/doublify/pre-commit-rust
rev: master
hooks:
- id: fmt
args: ['--verbose', '--edition', '2018', '--']
- repo: https://github.com/kajmaj87/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
args: ['--verbose', '--edition', '2018', '--']
```
21 changes: 0 additions & 21 deletions hooks.yaml

This file was deleted.