1 unstable release

0.1.0 May 22, 2021

#19 in #pre-commit

33 downloads per month

MIT license

575KB
1.5K SLoC

Rust 1K SLoC // 0.1% comments Lua 252 SLoC // 0.1% comments JavaScript 22 SLoC

hk

A tool for running hooks on files in a git repository.

[!CAUTION] This is a work in progress.

Installation

Use mise-en-place to install hk:

mise use hk
hk --version

Project Setup

Use hk generate to generate a hk.toml file:

hk generate

This will generate a hk.toml file in the root of the repository like this:

[[pre-commit]]
plugin = "end-of-file-fixer"

Usage

Inside a git repository with a hk.toml file, run:

hk install

This will install the hooks for the repository like pre-commit and pre-push if they are defined in the hk.toml file.

Running Hooks

To explicitly run the hooks without committing, use the hk run command.

hk run pre-commit

This will run the pre-commit hooks for the repository. This will run against all files that are staged for commit. To run against all files in the repository, use the --all flag.

hk run pre-commit --all

To run a specific hook, use the --hook flag.

hk run pre-commit --hook end-of-file-fixer

Dependencies

~35–69MB
~1M SLoC