[elbe-devel] RFC: using pep8 coding style

Torben Hohn torben.hohn at linutronix.de
Wed Dec 20 13:34:30 CET 2017


On Tue, Dec 19, 2017 at 04:30:52PM +0100, Manuel Traut wrote:
> Hi,
> 
> i would like to have a common coding style in elbe.
> PEP8 [0] describes a style-guide for python code.
> 
> There is tooling to check the coding style and for automatic refactoring.
> So it would be easy to ensure that we follow this coding style in the future.
> 
> $ cd elbe
> $ pycodestyle --statistics .
> 
> reports about 7000 coding style violations currently. After running
> 
> $ autopep8 -i -r -a -a -j 5 .
> 
> pycodestyle reports just about 100 violations. Most of them are 'E501 line to
> long' and some others. All can be easily fixed 'by hand':
> 
> 7       E211 whitespace before '('
> 6       E265 block comment should start with '# '
> 3       E266 too many leading '#' for block comment
> 2       E402 module level import not at top of file
> 98      E501 line too long (82 > 79 characters)

I am against 80 char lines. It seems to be configurable, and i would
like to see 120 or something.

i generally set the tabwidth to 8. This is different to what manut does.


> 7       E741 ambiguous variable name 'l'
> 
> 
> However an initial conversion introduces a lot of changes and so lowers the
> usability of git-blame:
> 
> $ git diff | diffstat | tail -1
>  94 files changed, 6206 insertions(+), 4850 deletions(-)
> 
> elbe is currently about 12k of python. So nearly every other line will be
> changed by the cleanup!
> 
> I would like to do the conversion in multiple patches. One big patch, that
> applies the changes from autopep8. And one single patch for each kind of error
> detected by pycodestyle.
> 
> What do you think?

i am fine with that.


-- 
Mit freundlichen Grüßen
Torben Hohn

Linutronix GmbH

Standort: Bremen

Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
Nr. / Trade register no.: 700 806

Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner

Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
möglich ist, durch Antwort-Mail. Vielen Dank!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20171220/91f00dbb/attachment.sig>


More information about the elbe-devel mailing list