How can I configure Pylint to check all things PEP8 checks?
Asked Answered
A

1

37

Searching for an answer on Pylint's mailing list brings no interesting results.

Pylint is known to be very customizable, so I guess this should be possible...

The reason I would like Pylint to check compliance with PEP8 is because

  • PyDev has much better support for Pylint than it has for PEP8.
  • It's easier to have one tool doing all checks than having to use two.

I also asked this question on Pylint's mailing list at http://thread.gmane.org/gmane.comp.python.logilab/1039

Example of diagnostic messages from PEP8 which I don't get from Pylint:

  • E203 whitespace before ':'
  • E225 missing whitespace around operator
  • E251 no spaces around keyword / parameter equals
  • E301 expected 1 blank line, found 0
  • E303 too many blank lines
  • E501 line too long (90 characters)
  • W291 trailing whitespace
  • W292 no newline at end of file
  • W293 blank line contains whitespace
Adventitious answered 29/7, 2011 at 22:25 Comment(1)
The link is broken (with a truly exotic error message: "Error 523. Ray ID: 6115420619df7383 • 2021-01-14 06:21:37 UTC. Origin is unreachable").Milker
I
12
  • E203 is not yet supported in Pylint AFAIK
  • E225 is C0322 / C0323
  • E251 should be C0322/C0323, but I'm not sure that Pylint does not special case parameters and allows lack of space there
  • E301, E303 are not supported AFAIK
  • E501 is C0301 and you can configure the length in your pylintrc
  • W291, W292 and W203 are not supported AFAIK.

It would be nice if you could report these as desired features over here.

Invasive answered 16/9, 2011 at 8:18 Comment(3)
Regarding C0322/3, in version 0.25.1, PyLint does have a 'special case' that allows there to be no spaces before/after the assignment operator for default and keyword arguments, but it doesn't complain if there is a space either side of the operator, which it probably should to be strictly PEP 8-compliant.Maria
Alex, are there any plans to support all PEP8 features? I'm asking as there was no activity in ticket #82519 since it was created almost a year ago...Adventitious
The official position is to use pycodestyle (former pep8 tool) for that. See github.com/PyCQA/pylint/issues/1970Zindman

© 2022 - 2024 — McMap. All rights reserved.