eradicate and black
tobiasraabe opened this issue · comments
Repost of wemake-services/flake8-eradicate#8.
Hi,
Thanks for the tool. Unfortunately, eradicate recognizes # fmt: on and # fmt: off as commented out code whereas the comments identify blocks which should not be formatted with black. Is it possible to exclude these patterns?
Best
Looks like Python 3 considers fmt: on
to be valid Python syntax. Python 2 does not though.
We might need need to explicitly exclude syntax that follows the pattern something_here: something_here
from being considered Python code.
>>> fmt = "foo"
>>> on = "bar"
>>> {
... fmt: on
... }
{'foo': 'bar'}
It's a slightly bigger problem than that, since something_here: something_here
is the syntax to annotate type starting in 3.6.
>>> on = int
>>> fmt: on
Probably issue with typing can be resolved using option for ignoring such cases. I thing var: type
alone should be not very common.
@myint It seems from code like this is already covered by aggressive setting?
https://github.com/myint/eradicate/blob/master/eradicate.py#L66
I thing
var: type
alone should be not very common.
it's rather common in annotations of class attributes, especially in dataclasses
Looks like the linked whitelist feature should be the way to go. It only requires these 2 statements to be whitelisted.
@myint hi!
Several my projects do depend on eradicate
(including https://github.com/sobolevn/flake8-eradicate and https://github.com/wemake-services/wemake-python-styleguide)
And I can see that you don't have much time to work on open-source. Maybe you can add me and other active contributors as maintainers? So we can help you with some on-going tasks like bugfixes and feature requests.
I would love to help! 👍
@sobolevn Welcome onboard!