I'm trying to introduce pre-commit
to our project. The project lives in a monorepo, and we would like to have all our checks to live in that same repo as well. We have a flake8
plugin, and I'm trying to configure the flake8 to use that plugin, however I cannot figure out how to have pre-commit
to install our plugin from the local repo.
I've added this to .pre-commit-config.yaml
repos:
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- ./my_flake8_plugin
But when I run pre-commit run --all
I get this error:
An unexpected error has occurred: CalledProcessError: command: ('/Users/dtv/.cache/pre-commit/repo0620p39l/py_env-python3.10/bin/python', '-mpip', 'install', '.', './my_flake8_plugin')
I do realise that I could specify the absolute path to the plugin, but that will not work on CI or other developers' machines. I couldn't find anything about "variables" or "placeholders" in the doc (e.g. so one could write something like - $(PROJECT_DIR)/my_flake8_plugin
.
Is there proper way of doing it apart from writing a separate pre-commit
plugin?