https://github.com/backplane/pre-commit-rust-hooks
pre-commit hooks for Rust
https://github.com/backplane/pre-commit-rust-hooks
Last synced: 5 months ago
JSON representation
pre-commit hooks for Rust
- Host: GitHub
- URL: https://github.com/backplane/pre-commit-rust-hooks
- Owner: backplane
- License: other
- Created: 2023-03-20T07:20:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-30T15:19:19.000Z (about 1 year ago)
- Last Synced: 2025-04-30T16:29:05.612Z (about 1 year ago)
- Size: 24.4 KB
- Stars: 3
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pre-commit hooks for Rust
[Rust](https://www.rust-lang.org) hooks for [pre-commit](https://pre-commit.com).
This repo was inspired by the pre-commit hooks found in [`doublify/pre-commit-rust`](https://github.com/doublify/pre-commit-rust) on 20-Mar-2023.
The code here is released with the [`0BSD`](https://opensource.org/license/0bsd/) license.
## Using the hooks
Add the following entry to your `.pre-commit.yml`
```yaml
- repo: https://github.com/backplane/pre-commit-rust-hooks
rev: v1.2.0
hooks:
- id: fmt
- id: check
- id: clippy
- id: test
```
Note: The id `fmt-check` is also available if you don't want automatic changes.
## Passing arguments:
If you pass an `args` list to a hook that receives filename arguments you should end that list with the `--` terminator (see below).
* The `fmt` and `fmt-check` hooks receive a list of filenames at the end of their arguments.
* The `check`, `clippy`, and `test` hooks do not receive a list of filenames as arguments.
```yaml
- repo: https://github.com/backplane/pre-commit-rust-hooks
rev: v1.2.0
hooks:
- id: fmt
args: ['--verbose', '--edition', '2018', '--']
```