Skip to content

Repository files navigation

precommit

Installation

To install binary :

cargo install --git=http://github.com/commure/precommit.git

Then in repository

precommit install <hook_yaml_file>

Information

Runs hooks specified in yaml based on regex test during git pre-commit for staged files.

Config file

<hook_name>:
commands: <list of commands to execute for given hook>
- command: <command to run>arguments: <command_arguments note special variable of filename which will fill in file that will be run>regex: <regex to test whether or not to run a given file>

Example

pre-commit:
prettier:
commands:
- command: prettierarguments: [--write, <filename>]
- command: gitarguments: [add, <filename>]regex: ".*(js|jsx|scss|md)$"eslint:
commands:
- command: eslintarguments: [<filename>]
- command: gitarguments: [add, <filename>]regex: ".*(js|sass|css)$"rustfmt:
commands:
- command: rustfmtarguments: [<filename>]
- command: gitarguments: [add, <filename>]regex: ".*(rs)$"clippy:
commands:
- command: cargoarguments: [clippy]regex: ".*(rs)$"print_yaml:
commands:
- command: catarguments: [<filename>]regex: ".*(yaml|yml)$"

About

git hook library

Resources

Stars

2 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages