Describe the bug
Given the following configuration in pyproject.toml
[tool.black]
line-length = 120
extend-exclude = [
'^(?:([^\/]+\/)+(?:test_.*\.py|.*_test\.py))$',
'.github',
'.mypy_cache',
'.pytest_cache',
'venv'
]
Black fails with the error:
Error: Invalid value for '--extend-exclude': Not a valid regular expression: unbalanced parenthesis at position 17
But this is a valid regex that's supposed to match any files starting or ending in test or files in a directory named test. For example, the following path matches the test directory:
myapp/folder/test/test_something.py
To Reproduce
I guess use the regex in a unit test that parses it?
Expected behavior
It should work. It would be even better if Black could use the extend-exclude list from flake8 or mypy, so that I don't have repeat it. The documentation only shows the max-line-length property.
Environment
- Black's version: 23.3.0
- OS: macOS Ventura 13.4.1, M1 chip
- Python version: (CPython) 3.11.3
Describe the bug
Given the following configuration in
pyproject.tomlBlack fails with the error:
But this is a valid regex that's supposed to match any files starting or ending in
testor files in a directory namedtest. For example, the following path matches thetestdirectory:myapp/folder/test/test_something.py
To Reproduce
I guess use the regex in a unit test that parses it?
Expected behavior
It should work. It would be even better if Black could use the
extend-excludelist from flake8 or mypy, so that I don't have repeat it. The documentation only shows themax-line-lengthproperty.Environment