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.
Prerequisites
- Python ≥ 3.12 Website | Github
- Git ≥ 2.30.0 Website | Git
- Gitleaks ≥ 8.28.0 Website | Github
- pre-commit ≥ 4.3.0 Website | Github
Hooked itself will be installed via pip.
pip install git+https://github.com/conmob-devsecops/hooked.git@mainBy 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.gitCongratulations 🎉 You now have hooked installed on your system!
# 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 hookedEnvironment 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. |
To install the development dependencies, create a virtual environment and activate it:
uv sync --dev
uv venv
source .venv/bin/activateThis 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