peterjc / flake8-black

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

[pre-commit.ci] autoupdate #83

Closed pre-commit-ci[bot] closed 9 months ago

pre-commit-ci[bot] commented 1 year ago

updates:

peterjc commented 1 year ago

Looks like Python 3.7 is OK, but otherwise:

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
1c1
< test_changes/black_preview.py:8:18: BLK100 Black would make changes.
---
> test_changes/black_preview.py:3:1: BLK100 Black would make changes.
peterjc commented 1 year ago

Looks like the double blank line behaviour has changed in preview mode:

$ flake8 --select BLK test_changes/black_preview.py --black-config with_pyproject_toml/pyproject.toml 
test_changes/black_preview.py:3:1: BLK100 Black would make changes.
[pcock@gruffalo tests]$ 
[pcock@gruffalo tests]$ 
[pcock@gruffalo tests]$ black --diff --preview test_changes/black_preview.py
--- test_changes/black_preview.py   2022-12-13 12:13:54+00:00
+++ test_changes/black_preview.py   2023-11-06 17:00:44.550105+00:00
@@ -1,11 +1,10 @@
 """Example showing future black string reformatting."""
-

 def hello():
     """Print variations on 'Hello World'."""
     # black v22.1.0 (first stable release) does not edit string literals,
     # so the following is untouched unless enable preview mode:
-    print("hello " "world")  # noqa: ISC001
+    print("hello world")  # noqa: ISC001

 hello()
would reformat test_changes/black_preview.py

All done! ✨ 🍰 ✨
1 file would be reformatted.
peterjc commented 1 year ago

I think this is an unwanted change in preview mode in black 23.10.0, see https://github.com/psf/black/issues/4027

peterjc commented 1 year ago

Will wait for the next release of black which fixes this regression.

Did rest in a149f319e2552d2ab8f7b136461e8d549e122620

peterjc commented 1 year ago

Python 3.7 was working as only installed black 23.3.0