Use case- Exclude all test files from flake8. In my project I have test files in different folders.
Current implementation:
- repo: https://gitlab.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
exclude: ^tests
Current Output:
integration-tests/test_1.py:21:1: F401 'pytest' imported but unused
Expected output: it should pass. It should not check tests.
you've excluded things which match the pattern ^tests and you have an error in integration-tests
your pattern needs to match those to exclude it properly
for example:
repos:
- repo: https://gitlab.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
exclude ^integration-tests/
or if you have both test paths, perhaps:
exclude: ^(tests|integration-tests)/
more on this in the documentation
disclaimer: I created pre-commit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With