Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add clippy hook to example #24

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
rev: v4.5.0
hooks:
- id: check-byte-order-marker
- id: check-case-conflict
Expand All @@ -11,6 +11,6 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pre-commit
rev: v2.5.1
rev: v3.6.2
hooks:
- id: validate_manifest
15 changes: 15 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,18 @@
args: ["--", "-D", "warnings"]
types: [rust]
pass_filenames: false
- id: test
name: test
description: Run tests with cargo test
entry: cargo test
language: system
types: [rust]
args: ["--all-targets"]
pass_filenames: false
- id: build
name: build
description: Build using cargo build
language: system
types: ["rust"]
entry: cargo build
pass_filenames: false
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@

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

Forked from: [doublify's pre-commit-rust](https://github.com/doublify/pre-commit-rust) (**NOTE: Their repo is unmaintained**)

## Using rust tools with pre-commit

```yaml
- repo: https://github.com/doublify/pre-commit-rust
- repo: https://github.com/antonio-hickey/rusted-pre-commits
rev: master
hooks:
- id: fmt
- id: cargo-check
- id: clippy
- id: build
- id: test
```

## Passing arguments to rustfmt

```yaml
- repo: https://github.com/doublify/pre-commit-rust
- repo: https://github.com/antonio-hickey/rusted-pre-commits
rev: master
hooks:
- id: fmt
args: ['--verbose', '--edition', '2018', '--']
args: ['--verbose', '--edition', '2021', '--']
```