Skip to content

CostcoFanboy/pre-commit-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pre-commit-rust

Rust hooks for pre-commit.

Usage

Add this to your .pre-commit-config.yaml:

- repo: https://github.com/CostcoFanboy/pre-commit-rust
  rev: master  # Use the latest tag or commit hash
  hooks:
    - id: fmt
    - id: clippy

Available Hooks

cargo-check

Checks the package for compile errors without producing binaries.

- id: cargo-check

fmt (rustfmt)

Formats Rust code according to style guidelines. This hook runs in check mode and will fail if code is not formatted.

- id: fmt

clippy

Runs the Clippy linter with strict settings, treating warnings as errors.

- id: clippy

test

Runs the test suite using cargo test.

- id: test

audit

Checks for known security vulnerabilities in dependencies. Requires cargo-audit to be installed.

Install with:

cargo install cargo-audit

Then add to your config:

- id: audit

Example Configuration

Here's a complete example using all available hooks:

- repo: https://github.com/CostcoFanboy/pre-commit-rust
  rev: master
  hooks:
    - id: cargo-check
    - id: fmt
    - id: clippy
    - id: test
    - id: audit

Requirements

  • Rust toolchain (rustc, cargo, rustfmt, clippy)
  • cargo-audit (optional, only needed for the audit hook)

License

See LICENSE file.

About

Rust hooks for http://pre-commit.com/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •