[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Standardizing python code using pylint

From: Bhuvaneswaran A <bhuvan_at_collab.net>
Date: Fri, 18 Dec 2009 09:54:36 +0530

ping? Any comments on this proposal?

On Sun, 2009-12-06 at 22:29 +0530, Bhuvaneswaran A wrote:
> As discussed in this email thread [1], I've come up with the pylint
> rules for standardizing the python code throughout the repository.
>
> Few of rules that would be of crowd's interest are as follows:
>
> * Regex for functions: [a-z_][a-z0-9_]{2,30}$
> * Regex for methods: [a-z_][a-z0-9_]{2,30}$
> * Regex for arguments: [a-z_][a-z0-9_]{2,30}$
> * Regex for variables: [a-z_][a-z0-9_]{2,30}$
> * Maximum no of arguments: 5
> * Maximum no of locals: 15
> * Maximum return statement in a function/method: 6
> * Maxium statements in function/method: 50
> * Minimum public method: 2
> * Maximum public method: 20
> * Deprecated methods: regsub,string,TERMIOS,Bastion,rexec
> * Maximum line length: 80
> * Maximum module lines: 1000
>
> Please refer to the pylintrc file in the below link for all such rules.
> Most of these rules are part of pylint standard.
>
> For now, I've not considered the indentation, be it 2 or 4 space. We
> follow both these indentation (2 and 4) equally in our code, so far. If
> we set this rule as say 4, the scoring for most of our code goes in
> negative in the scale of 10! If anyone strongly believe that we MUST
> follow one standard, say 4 space for indentation, even if it also mean,
> modifying our existing code, please speak up!
>
> Based on the above rules I've run pylint report for few python scripts,
> and they are accessible from here. The reports are not intuitive, but it
> should give us an hint on current coding standard:
> http://people.apache.org/~bhuvan/pylint/
>
> From here, I propose to fix all the error and fatal errors in our code.
> The errors are the messages that begin with 'E' character. Ex: E0602,
> undefined variable. The fatal ones are the messages that begin with 'F'
> character. Ex: F0001, unable to import. For a complete list of such
> pylint messages and corresponding code, please refer to this link:
> http://people.apache.org/~bhuvan/pylint/list-msg-codes.txt
>
> We should set a minimum score for any python code that is checked-in our
> repository. I suggest it to be 9.80/10.00. Comments are welcome. Any
> questions, let me know. Thank you.
>
> [1] http://bit.ly/8ujHS8

-- 
Bhuvaneswaran A    
CollabNet Software P Ltd.  |  www.collab.net

Received on 2009-12-18 05:25:57 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.