Closed EricCousineau-TRI closed 5 years ago
The pycodestyle
binary has a built-in ignore list (e.g., E121,E123,E126,E226,E24,E704,W503), which if you provide your own list will completely override it.
Aye. So perhaps a user-friendly fix is to either (a) provide extra_ignore
or (b) provide the builtin list as a constant (PYTHON_LINT_IGNORE_DEFAULT
or something)?
Doing import drake.bar # noqa
is the best resolution, is it not?
Not really; it's quick-ish, but I don't think it's the best resolution.
Also, I'd have to defect the current docs for python_lint(ignore = ...)
as this behavior surprised me.
With #10536, I would have had to have added about 10 different #noqa
s, which seems like a waste if I can just ignore that directive (or fix upstream). (This is low priority since it'd be nice, but not critical, to have a better resolution.)
You are welcome to fix the docs, sure. Personally I think that notating unusual code at every use is a feature, and hiding the suppression in the BUILD file is a bug, but that is irrelevant to whether or not the linter docs are clear.
SGTM.
When doing #10536, I first tried just ignoring
E402 module level import not at top of file
errors that were caused bywith
statements (see https://github.com/PyCQA/pycodestyle/pull/834).Example offending patch on 75fa68783:
If I run
bazel test --config=lint //bindings/pydrake/systems/...
, this is the only error triggered.When I added
python_lint_ignore = [402]
, it triggeredE226 missing whitespace around arithmetic operator
in a slew of source files.Patch: