wemake-python-styleguide: Outdated information about black incompatibilities
Bug report
What’s wrong
Documentation states that project is is not compatible with black. As far, as I know, some points are not relevant now.
for some reasons black uses " that almost no one uses in the python world
There is option for skipping this check now: https://github.com/psf/black/issues/118#issuecomment-393298377
Line length. Violating rules by 10%-15% is not ok. You either violate them or not. black violates line-length rules.
Black now supports changing line length too. In our setup it has not problems with flake8.
There is still issue with trailing commas, I guess. While this does not trigger flake8 itself.
How is that should be
Sentence And there’s no configuration to fix it! must be somehow corrected, for example by adding instructions for making black work with project.
System information
Not relevant.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 6
- Comments: 15 (12 by maintainers)
That’s exactly what we can use in the docs about incompatibilities!
Great job! Thanks a lot. 👍
I am not sure what does
official supportmeans here. Does this Makefile task used for linting this repo?I can make PR if waiting couple of weeks is okay.
Also looks like black is now leaving trailing commas, if python36 support is enabled, if I understand objective in your doc correcly. Black doc says:
https://black.readthedocs.io/en/stable/the_black_code_style.html?highlight=flake8#trailing-commas
I would love to edit the text to reflect what the people have said regarding the attempt to make black compatible with WPS.
Also another note:
See https://github.com/pre-commit/pre-commit-hooks
Done steps
If I understand correctly to add
autopep8analog inmake lint, would be equivalent to addingblack --check .. For this codebase must be formated withblackfirst.I tried to format codebase with configured
black, and this leads to huge changes. Diff stat is:303 files changed, 6739 insertions(+), 9085 deletions(-).Then I check, if reformated codebase matches flake8 checks. Here is stats of found violations (that, as far as I understand, it’s worth considering incompatibilities):
Description of incompatibilities
C812 - appears in case when all arguments are on the same line, but brackets are on surrounding lines (checked 5 examples). Example of incompatible code, formatted with black:
D202 appears only in case, when local function comes right after docstring (i checked about 5 examples of error). Example of incompatible code, formatted with black:
E203 is known incompability betweeen flake8 and black. They claim that is issue on flake8 side: https://github.com/psf/black/issues/315#issuecomment-395457972
W503 is known incompability betweeen black and pycodestyle. Black claims that W503 is against PEP8. pycodestyle docs says that W503 is disabled by default, because “they are not rules unanimously accepted, and PEP 8 does not enforce them”. https://github.com/psf/black/issues/52
WPS317 in all, but one, cases is encountered in comples
@pytest.mark.parametrize. Probably somehow related with multiline lists/tuples in arguments. Example formatted with black:WPS348 - looks like black has different strategy on such cases https://black.readthedocs.io/en/stable/the_black_code_style.html#call-chains
Yeap,
official supportin this context means that we check that all our code is compatible with the autoformatter we support. We guarantee it by adding this check inside the CI. And since we supportpython3.6+we are also fine with the trailing comma feature.Several weeks are totally fine, no pressure here.