peterjc / flake8-black

flake8 plugin to run black for checking Python coding style
MIT License
165 stars 10 forks source link

flake8-black incompatible with black v22.1.0 #44

Closed tkalus closed 2 years ago

tkalus commented 2 years ago

It appears there is an unknown incompatibility between the latest release of black (v22.1.0) and flake8-black (both master branch and v0.2.3 via PyPI).

All files are returning the error BLK999 Unexpected exception: unsupported operand type(s) for /: 'tuple' and 'str' when linted by flake8 with flake8-black enabled.

flake8-black's own tests fail with latest black using the master branch:

[~/src/github.com/peterjc/flake8-black/tests]$ git branch --show-current
master
[~/src/github.com/peterjc/flake8-black/tests]$ pip freeze | grep ^black
black==22.1.0
[~/src/github.com/peterjc/flake8-black/tests]$ ./run_tests.sh
Checking our configuration option appears in help
  --black-config TOML_FILENAME
Checking we report an error when can't find specified config file
ValueError: Plugin flake8-black could not find specified black config file: --black-config does_not_exist.toml
Checking failure with mal-formed TOML file
ValueError: Plugin flake8-black could not parse specified black config file: --black-config with_bad_toml/pyproject.toml
Checking we report no errors on these test cases
test_cases/hello_world.py:0:1: BLK999 Unexpected exception: unsupported operand type(s) for /: 'tuple' and 'str'
test_cases/stub.pyi:0:1: BLK999 Unexpected exception: unsupported operand type(s) for /: 'tuple' and 'str'

tests pass with a downrev 21.12b0 version of black:

[~/src/github.com/peterjc/flake8-black/tests]$ git branch --show-current
master
[~/src/github.com/peterjc/flake8-black/tests]$ pip freeze | grep ^black
black==21.12b0
[~/src/github.com/peterjc/flake8-black/tests]$ ./run_tests.sh
Checking our configuration option appears in help
  --black-config TOML_FILENAME
Checking we report an error when can't find specified config file
ValueError: Plugin flake8-black could not find specified black config file: --black-config does_not_exist.toml
Checking failure with mal-formed TOML file
ValueError: Plugin flake8-black could not parse specified black config file: --black-config with_bad_toml/pyproject.toml
Checking we report no errors on these test cases
Checking we report expected black changes
Tests passed.
peterjc commented 2 years ago

Fixed in #45, new release pending...

peterjc commented 2 years ago

Fixed in v0.2.4 which is now on PyPI. Thanks for reporting this.