[libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

Cole Robinson crobinso at redhat.com
Thu Sep 12 14:05:34 UTC 2019


On 9/12/19 9:18 AM, Andrea Bolognani wrote:
> On Thu, 2019-09-12 at 12:00 +0100, Daniel P. Berrangé wrote:
>> On Thu, Sep 12, 2019 at 12:56:04PM +0200, Andrea Bolognani wrote:
>>> FWIW, libvirt-dbus is using flake8 to achieve what I believe is
>>> basically the same result, whereas virt-manager I think uses pylint
>>> and pycodestlye.
>>>
>>> I am not familiar enough with the Python ecosystem to be able to
>>> compare the various linters, but it would IMHO make sense to at
>>> least try to standardize on one or more of them and use them across
>>> libvirt-related projects.
>>
>> pep8 validates code style against published PEP style guidelines.
>>
>> pyflakes does static analysis to detect code errors
>>
>> flake8 is a wrapper that runs pep8 and pyflakes and does some
>> other stuff.
>>
>> For just doing this semicolon check then pep8 is sufficient,
>> but for a more general approach, then flake8 makes more
>> sense. In that case we'd delete sc_prohibit_semicolon_at_eol_in_python
>> entirely, and simply have a generic 'sc_flake8' check that runs a
>> configured list of checks against all py code.
> 
> Yeah, the more general approach makes sense to me, so I would go
> that route directly instead of introducing pep8 first and only then
> moving to flake8.
> 

I don't have much experience with flake8 but I know it's commonly used,
so it sounds fine to me. FWIW though the pep8 tool naming is outdated,
the project was renamed to pycodestyle in early 2016, which does affect
config file naming and format

https://github.com/PyCQA/pycodestyle

- Cole




More information about the libvir-list mailing list