Rust-based hooks for pre-commit and pre-commit.ci.
Runs cargo fmt with RUSTUP_TOOLCHAIN=nightly.
Example:
- repo: https://github.com/arista-netdevops-community/pre-commit-hooks
rev: <rev>
hooks:
- id: cargo-fmt-nightly
args:
- --all
- --
- --config
- unstable_features=true,group_imports=StdExternalCrate,imports_granularity=ItemRuns cargo fmt with the target repository's selected Rust toolchain.
Example:
- repo: https://github.com/arista-netdevops-community/pre-commit-hooks
rev: <rev>
hooks:
- id: cargo-fmt
args: ["--all"]Runs cargo check with the target repository's selected Rust toolchain.
Example:
- repo: https://github.com/arista-netdevops-community/pre-commit-hooks
rev: <rev>
hooks:
- id: cargo-check
args: ["--locked"]Runs cargo clippy with the target repository's selected Rust toolchain.
Example:
- repo: https://github.com/arista-netdevops-community/pre-commit-hooks
rev: <rev>
hooks:
- id: cargo-clippy
args: ["--locked", "--all-targets", "--all-features"]Runs cargo-deny directly. The hook installs and invokes the version pinned as a
Cargo CLI dependency in pre-commit's isolated environment.
Example:
- repo: https://github.com/arista-netdevops-community/pre-commit-hooks
rev: <rev>
hooks:
- id: cargo-deny
args: ["--locked", "--all-features", "check"]Generates licenses with the cargo-about library linked into cargo-about-hook.
The dependency version is maintained in Cargo.toml; no separate cargo-about
executable or Cargo CLI installation features are needed. Installing the Rust
hooks requires Rust 1.88 or newer.
The adapter supports only generate, with --locked, --manifest-path,
-o/--output-file, and a single Handlebars template file. It discovers
about.toml beside the manifest or in a parent directory, using cargo-about's
configuration, workarounds, and license-resolution behavior. Output defaults to
stdout; -o - also writes to stdout.
Example:
- repo: https://github.com/arista-netdevops-community/pre-commit-hooks
rev: <rev>
hooks:
- id: cargo-about
name: Generate third-party Rust licenses
args:
- generate
- --locked
- -o
- pyavd_utils/THIRD_PARTY_LICENSES.txt
- about-text.hbsLet pre-commit report changed files. The adapter uses cargo-about's default
license-resolution behavior and does not expose --fail or its other CLI
commands and options.