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: rustfmtThe same as rustfmt, but acts on the whole project
| key | default |
|---|---|
on_event |
pre-commit |
on_file_regex |
.* |
action |
cargo fmt |
hooks:
- name: cargo fmtRuns the compiler on the rust project, reporting errors
| key | default |
|---|---|
on_event |
pre-commit |
on_file_regex |
.* |
action |
cargo check |
hooks:
- name: cargo checkLaunches the project’s tests
| key | default |
|---|---|
on_event |
pre-push |
on_file_regex |
.* |
action |
cargo test |
hooks:
- name: cargo testRuns clippy on your project
| key | default |
|---|---|
on_event |
pre-push |
on_file_regex |
.* |
action |
cargo clippy |
hooks:
- name: clippyA 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