You are here: Home Personal My Blog Hunting the Pylint Score

Hunting the Pylint Score

by Harald Hoyer last modified Apr 21, 2008 12:01 PM
With pylint, eclipse and eric4 you have all the tools in Fedora to make your python application more bug free and look better.

When we started system-config-network back in May 2001, we had emacs/vi for python development. I finally got used to work with emacs on s-c-network, using pychecker from time to time. But because, we generate some classes on the fly, it reported too much false positives to be really useful. python being an interpreter language sucks, if you do not have tools for syntax checking, because all it does, is traceback at runtime, as you can see by the many bugs s-c-network has.

Three weeks ago, I read an article why to use pychecker, where pylint is far more advanced. This made me curious and I ran pylint on s-c-n-1.5.1.

$ pylint --rcfile=/dev/null netconfpkg netconf netconf_tui netconf_control netconf_cmd
...

Global evaluation
-----------------
Your code has been rated at -1.78/10

Wow. That is depressing. So I looked at what pylint tries to tell me. Way too much to jump to all these messages in emacs. So I gave eclipse with eclipse-pydev another chance (after trying it years ago). Though you have to refresh the pylint output sometimes by Project->make clean I could eliminate some bugs and also mark false positives by adding comments like this:

# pylint: disable-msg=E1101

The hunt for a better pylint score has begun :-). Looking for a source code beautifier (tell me, if you know one), I stumbled upon eric4, which is another great IDE. On Fedora 8, you can install it from Fedora 9 (currently the development repo) with:

# yum install eric
# yum --enablerepo=development update eric

Now eric4 gave me full pylint control. So after weeks of bug fixing, refactoring, formatting, a genClass replacement, a python recipe for the cookbook, my pylint output looks like this:

$ pylint --rcfile=/dev/null netconfpkg netconf netconf_tui netconf_control netconf_cmd
...

Global evaluation
-----------------
Your code has been rated at 7.73/10

Now, that is far more satisfying :) If only we had pylint, eclipse and eric4 back in 2001...

Help me to beta test this new version, either by checking out the latest git version from the experimental branch:

$ git clone git://git.fedorahosted.org/git/system-config-network
$ cd system-config-network
$ git checkout --track -b experimental origin/experimental

or install the packages right away, which were built on Fedora 8 scratch and uploaded to http://people.fedoraproject.org/~harald/downloads/system-config-network/ , or just wait, until I submit it as an update test release.

You may also have a look at the system-config-network project page: https://fedorahosted.org/system-config-network

Update: The experimental branch has been merged into the HEAD of the master branch.

 

Filed under: , ,
Add comment

You can add a comment by filling out the form below. Plain text formatting.

(Required)
Please enter your name.
(Required)
(Required)
(Required)
Enter the word