Skip to content


Repository files navigation


CI Build Status

Olist custom pre-commit plugins


To configure custom pre-commit hooks, create or add an entry in your .pre-commit-config.yaml as follows:

  - repo:
  rev: main
    - id: check-invalid-domains

Update pre-commit plugins:

pre-commit autoupdate

Test the custom hook(s) against all your codebase:

pre-commit run -a -v

The list of available hooks could be found on pre_commit_hooks_file or using show_hooks command:

python -q show_hooks


Create an virtualenv using Python 3.6+ and install the development requirements:

pip install -r requirements-dev.txt

Optionally, add the package in your current virtualenv for easier access:

python develop
# now you should be able to call any hook by the entry name:
# my-hook <files>

To execute the repository tests:

make tests

Creating new hooks

To create a new hook:

  • Copy the example hook: cp hulks/ hulks/
  • Add an entry in .pre-commit-hooks.yaml (more options in pre-commit-documentation)
  • Develop and test your hook following the guidelines below
  • Update CHANGES.rst properly


Keep in mind that all plugins are installed via script by pre-commit.

The following guides should help us when creating new hooks:

  • Add an entry in .pre-commit-hooks.yaml

    • the name entry should be the hook path (eg hulks.my_hook)
  • Your hook entrypoint is always a function named main
  • Add your hook dependencies in requirements.txt


To test a newly added hook, you can:

  • Follow these instructions. (you must commit your code before testing)
  • Add the hook to another project .pre-commit-config.yaml. (you must commit your code before testing)
  • Update pre-commit (pre-commit autoupdate)
  • Or simple run python -m hulks.my_new_hook <filenames>.


Check if CHANGES.rst contains the correct version number (follow semver). Create the proper tags with:

make release