I use flake8 with a bunch of plugins (flake8-docstrings, flake8-isort, flake8-black). I have them all pre-installed into a venv.
My repo to be checked with pre-commit:
- Root folder has two packages
- Each has its own
pyproject.toml(configuresblackandisort)setup.cfg(configuresflake8andpydocstyle)
├── foo
│ ├── pyproject.toml
│ ├── setup.cfg
│ └── (the package)
├── bar
│ ├── pyproject.toml
│ ├── setup.cfg
│ └── (the package)
└── venv
I want to invoke flake8 via pre-commit for the two packages.
Here's how I do it currently:
---
repos:
- repo: local
hooks:
- id: flake8-foo
name: Run flake8 in foo package
entry: bash -c "cd foo && flake8"
language: python
- id: flake8-bar
name: Run flake8 in bar package
entry: bash -c "cd bar && flake8"
language: python
When I run pre-commit run --all-files and there's an error in foo, it prints the same output many times:
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
./path/in/foo/to/file.py:49:1: D401 First line should be in imperative mood
- Is there a better way to go about this?
- No, I am not open to splitting up the packages into their own repos
- How can I have the error message only print once?