Description
The # noqa: E241
comment notation is not respected by pycodestyles
.
This is extremely inconvenient for following reasons:
-
It is not obvious at first glance that
pycodestyle
discriminates between some codes and not others when using# noqa
(as described in intro). This causes harder interpretation of# noqa
cross the code. -
pycodestyle
allows and already correctly handlesignore = E241
via the config or corresponding input argument when applied globally. So on one side it advertises some form of control of ignored/selected errors, but on the other enforces for no specific reason to not support# noqa: E241
locally (although some other# noqa
codes work). -
The doc seems to somewhat contradict itself by not allowing
# noqa
specifically forE241
. It is said thatE241
is among codes that are ignored by default:(*) In the default configuration, the checks E121, E123, E126, E133, E226, E241, E242, E704, W503, W504 and W505 are ignored because they are not rules unanimously accepted, and PEP 8 does not enforce them.
But then, if I need to provide more/other codes to ignore than the defaults (
--ignore
or configignore =
), I loose the flexibility to control which lines they apply to, although it is agreed that PEP8 don't enforce them.
I am aware that issue #924 was closed saying that flake8
can be used instead to respect that notation, and this is "fine", as I use it also that way and it works. The problem arises when trying "fix" those issues.
I am using tool autopep8
, which under the covers uses pycodestyle
to apply fixes.
flake8
does not provide fixing feature, so I have to go with autopep8
which respects what pycodestyle
tells it.
I also do not want to apply ignore = E241
globally, because I want to catch cases where incorrect indents and spaces where added by mistake. I want only E241
to be ignored for explicit cases where indentation provides more readability (e.g.: in tests with many aligned columns of corresponding values), where E241
should be disabled explicitly and only for those lines. This also follows PEP8 mentality that one should be allowed to bypass recommendations especially for cases of improving readability.
For all these reasons, I would like to request that pycodestyle
increases the number of error codes it supports via # noqa
and let the user customize local overrides, but with my main concern around E241
specifically if all codes makes the change scope too big.