This repo contains hook definitions to be consumed by git-hooks, aimed at rust projects.
This hook is useful to reformat files according to rust’s standards.
key | default |
---|---|
on_event |
pre-commit |
on_file_regex |
.*\.rs |
action |
rustfmt {files} |
hooks:
- name: rustfmt
The same as rustfmt
, but acts on the whole project
key | default |
---|---|
on_event |
pre-commit |
on_file_regex |
.* |
action |
cargo fmt |
hooks:
- name: cargo fmt
Runs the compiler on the rust project, reporting errors
key | default |
---|---|
on_event |
pre-commit |
on_file_regex |
.* |
action |
cargo check |
hooks:
- name: cargo check
Launches the project’s tests
key | default |
---|---|
on_event |
pre-push |
on_file_regex |
.* |
action |
cargo test |
hooks:
- name: cargo test
Runs clippy on your project
key | default |
---|---|
on_event |
pre-push |
on_file_regex |
.* |
action |
cargo clippy |
hooks:
- name: clippy
A simple python script looking for inconsistencies between Cargo.toml’s `package.version
and the latest git tag.
It will fail the event if the most recent git tag is greater than the package’s version
This only supports simple version string in the form <digits>.<digits>.<digits>
, which is the default cargo format.
key | default |
---|---|
on_event |
pre-commit |
on_file_regex |
.* |
action |
version_match |
hooks:
- name: version_match