[openstack-dev] migration to flake8
Monty Taylor
mordred at inaugust.com
Fri Apr 5 22:58:59 UTC 2013
On 04/04/2013 01:17 PM, Andrew Laski wrote:
> On 04/04/13 at 12:00pm, Dolph Mathews wrote:
>> i'm certainly in favor, as I already use flake8 in vim.
>
> Me too, for the same reason.
>
>>
>> It's just an annoyance to me, but the only gotcha I've found is that I
>> have
>> no idea how to tell it to specifically ignore '_' being undefined (for
>> i18n).
>
> alaski at crypt ~ $ cat
> ~/.config/pep8
> [pep8]
> builtins = _
>
> but this only works for later versions of pep8, so I have to comment it
> out for running unit tests, which is another reason I'm in favor of the
> move.
For our projects, we can put builtins = _ into the flake8 section of our
tox.ini files and it will make the magic happiness.
>> On Thursday, April 4, 2013, Monty Taylor wrote:
>>
>>> Hey all!
>>>
>>> I was going to chat with folks about this at the summit, but it seems to
>>> be gaining momentum anyway, so there may not be a lot of pushback.
>>>
>>> Proposal:
>>>
>>> Replace pep8 and pyflakes and pylint and hacking.py in our testing with
>>> flake8
>>>
>>> Rationale:
>>>
>>> flake8 is the new pluggable hotness for this sort of thing. Out of the
>>> box it runs pep8 and pyflakes. The combo of those two winds up being
>>> very consistent and easy to deal with, so the extra goodness we get from
>>> pylint isn't really needed anymore. pyflakes regularly catches actual
>>> bugs for me, so rather than being just more style stuff, I'm pretty
>>> pleased with it as a useful bit of testing. It's also totally possible
>>> and easy to write pyflakes clean code.
>>>
>>> flake8 supports reading options from tox.ini, which we already have in
>>> our trees - even if you aren't using tox to run it. So we can set
>>> project options easily (like ignore=E125) and just running flake8 from
>>> the command line - or inside of vim/emacs - will work with the right
>>> settings.
>>>
>>> pyflakes issues show up prefixed by "F" and each one can be ignored now
>>> just like with pep8.
>>>
>>> flake8 also supports configurable additions to builtins, which lets us
>>> deal with the normal pyflakes issue with how we do gettext.
>>>
>>> I've also taken hacking.py from nova and turned it into a flake8 plugin,
>>> which means we can use that without copying it around. The hacking
>>> plugin is in openstack-dev/hacking in gerrit. If you install it, it will
>>> inject into the flake8 workflow and show its errors prefixed with "H".
>>>
>>> If there is a massive trainwreck on a line and pyflakes/hacking just
>>> can't deal with reality, you can add a # noqa tag to the line and it'll
>>> be skipped. We should probably be very limited in our usage of those.
>>>
>>> End result: no need for wrapper scripts around pep8, pyflakes or pylint.
>>> And a single, easy to deal with static-analysis check.
>>>
>>> Several of the infra projects have switched already, Maru just put up a
>>> quantum patch and I've got a ceilometer patch up for the switch. Patches
>>> for everyone else should be super easy.
>>>
>>> Thoughts?
>>>
>>> Monty
>>>
>>> _______________________________________________
>>> OpenStack-dev mailing list
>>> OpenStack-dev at lists.openstack.org <javascript:;>
>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>>
>>
>>
>> --
>>
>> -Dolph
>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
More information about the OpenStack-dev
mailing list