Skip to content

rust hooks for paulollivier/git-hooks

Notifications You must be signed in to change notification settings

aurelien-naldi/rust-hooks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust hooks

This repo contains hook definitions to be consumed by git-hooks, aimed at rust projects.

hooks

rustfmt

This hook is useful to reformat files according to rust’s standards.

Table 1. Override-able values
key default

on_event

pre-commit

on_file_regex

.*\.rs

action

rustfmt {files}

Usage in .hooks.yaml
hooks:
  - name: rustfmt

cargo fmt

The same as rustfmt, but acts on the whole project

Table 2. Override-able values
key default

on_event

pre-commit

on_file_regex

.*

action

cargo fmt

Usage in .hooks.yaml
hooks:
  - name: cargo fmt

cargo check

Runs the compiler on the rust project, reporting errors

Table 3. Override-able values
key default

on_event

pre-commit

on_file_regex

.*

action

cargo check

Usage in .hooks.yaml
hooks:
  - name: cargo check

cargo test

Launches the project’s tests

Table 4. Override-able values
key default

on_event

pre-push

on_file_regex

.*

action

cargo test

Usage in .hooks.yaml
hooks:
  - name: cargo test

clippy

Runs clippy on your project

Table 5. Override-able values
key default

on_event

pre-push

on_file_regex

.*

action

cargo clippy

Usage in .hooks.yaml
hooks:
  - name: clippy

version_match

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.

Table 6. Override-able values
key default

on_event

pre-commit

on_file_regex

.*

action

version_match

Usage in .hooks.yaml
hooks:
  - name: version_match

About

rust hooks for paulollivier/git-hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 89.7%
  • Shell 10.3%