Where I work we have some teams using flake8 and some teams that use pylint, and while pylint is more thorough, it is also slower and pickier, and the general sense is to strongly prefer flake8.

I honestly expect that running either with close-to-default flags on stdlib code would be a nightmare, and I wouldn't want *any* directives for either one to appear in stdlib code, ever.

In some ideal future all code would just be reformatted before it's checked in -- we're very far from that, and I used to be horrified by the very idea, but in the Go world this is pretty much standard practice, and the people at work who are using it are loving it. So I'm trying to have an open mind about this. But there simply isn't a tool that does a good enough job of this.

What I was thinking of was a much weaker option like tabnanny.py by Tim Peters (still in the stdlib!), but I don't know whether this is feasible.

What we need now is not more opinions on which formatter or linter is best. We need someone to actually do some work and estimate how much code would be changed if we ran e.g. tabnanny.py (or something more advanced!) over the entire stdlib, how much code would break (even the most conservative formatter sometimes breaks code that wasn't expecting to be reformatted -- e.g. we used to have tests with significant trailing whitespace), and how often the result would be just too ugly to look at. If you're not willing to work on that, please don't respond to this thread.

--Guido

On Wed, Feb 21, 2018 at 7:03 PM, Dan Stromberg <drsalists@gmail.com> wrote:
On Wed, Feb 21, 2018 at 2:19 PM, Barry Warsaw <barry@python.org> wrote:
> On Feb 21, 2018, at 13:22, Guido van Rossum <guido@python.org> wrote:
>>
>> I'm willing to reconsider if there's a good enough tool. Ditto for C code (or do we already do it for C?).
>
> For Python code, flake8 --possibly with our own custom plugins— is the way to go.

Is flake8 that much better than pylint, that pylint wouldn't even be discussed?

pylint does warn about some relatively unimportant things out of the
box, but it can be configured to ignore (almost?) everything it
checks.

I've been editing Python code in vim with syntastic.  I have syntastic
set up to run pyflakes, pycodestyle and pydocstyle.  And I have a
macro that saves the buffer, shells out and runs "make" with the
default rule - and that default rule almost always does a
whole-program pylint.

It's possible to make pylint check just one file from syntastic, but I
don't do that because it's too slow on large files.

I've gotten the impression that pylint can detect some errors that
pyflakes misses.  Not sure about flake8.

I do like it that flake8 has a mccabe check.  pylint doesn't appear to
have that, and instead relies on things like "too many statements",
"too many branches" and "too many variables".
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org



--
--Guido van Rossum (python.org/~guido)