Skip to content

Repository files navigation

HOOKED

GitHub Tag GitHub License Python Git pre-commit

Hooked

Hooked is a tool to automate of the use of pre-commit hooks in your local repositories. It configures your local environment by inserting global hooks and templates into your git workflow.

At the moment, only pre-commit is supported. Other frameworks may be added in the future.

🌱 Installation

Prerequisites

Hooked itself will be installed via pip.

pip install git+https://github.com/conmob-devsecops/hooked.git@main

⚠️ Some managed python environments (e.g., homebrew) don't allow you to install hooked via pip directly. Please read the installation manual for more details.

By now hooked should be available on your shell. You may check the version of hooked.

$ hooked version
Hooked version: 0.4.3

Next, we need a rule set installed, for hooked to work. An example rule set can be found at hooked-ruleset-tsi. Rule sets are stored locally. By default, the main branch is used, but you can specify a different branch using the --branch option.

hooked install https://github.com/conmob-devsecops/hooked-ruleset-tsi.git

Congratulations 🎉 You now have hooked installed on your system!

Usage

# check prerequisites for hooked
hooked check

# update the installed rule set
hooked update

# update hooked itself
hooked self-upgrade

# Get the hooked help
hooked --help

# skip the execution of hooked for a single commit
HOOKED_SKIP=1 git commit -m "my commit message"

# disable hooked
hooked disable

# enable hooked again
hooked enable

# disable hooked and remove local rule set
hooked disable --prune

# uninstall hooked
hooked disable --prune
pip uninstall hooked

Environment variables

Variable Description
HOOKED_SKIP_UPGRADE_CHECK If set to any value disables the automatic upgrade check.
HOOKED_LOG_LEVEL Sets the logging level.
HOOKED_SKIP If set to any value. skips the execution of pre-commit hooks.

Development

To install the development dependencies, create a virtual environment and activate it:

uv sync --dev
uv venv
source .venv/bin/activate

This will create a .venv directory with the virtual environment. Use this as your Python interpreter in your IDE, or activate it manually, depending on your setup.

To run the tests, use pytest:

uv run pytest --cov=src/hooked

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages