pylint scores

Peter Otten __peter__ at web.de
Fri Jul 30 09:45:37 EDT 2010


wheres pythonmonks wrote:
> I am starting to use pylint to look at my code and I see that it gives a
> rating. What values do experienced python programmers get on code not
> targeting the benchmark?
>> I wrote some code, tried to keep it under 80 characters per line,
> reasonable variable names, and I got:
>> 0.12 / 10.
>> Is this a good score for one not targeting the benchmark? (pylint
> running in default mode)

No. About 5 is typically OK for undocumented code. 
I've heard.
Ratings do not always make sense:
$ for f in /usr/lib/python2.6/{glob,csv,doctest,collections}.py; do echo $f; 
pylint 2>/dev/null $f | grep "Your code has"; done
/usr/lib/python2.6/glob.py
Your code has been rated at 8.54/10
/usr/lib/python2.6/csv.py
Your code has been rated at 6.45/10
/usr/lib/python2.6/doctest.py
Your code has been rated at 7.77/10
/usr/lib/python2.6/collections.py
Your code has been rated at -4.71/10
$
For mainstream code you can easily reach 10 by adding bogus docstrings and 
pointless long variable names, i. e. you can get higher scores for lower 
code quality.
Peter
PS: My favourite wtf message is "too few public methods"


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /