Archive

Posts Tagged ‘pylint’

GUI for the output of PyLint

April 7, 2011 Leave a comment

Problem

I discovered PyLint yesterday and after some tests I find it very useful. However, one thing bothered me in the workflow. PyLint tells you where (in which lines) you should improve your code but if you add/remove some lines in the source, these line numbers become invalid. Thus, you need to relaunch pylint lots of times until you resolve all the problems.

Solution

Idea: make a simple GUI that shows the output of PyLint. If necessary, refresh the content of this window.

Download:

Visit https://github.com/jabbalaci/PyLint-Output-Visualizer. Source code is here.

Usage:

pylov.py <source_to_be_analyzed.py>

You can refresh the content by pressing ‘r’, ‘u’, or F5.

Update (20110408)
This morning I was notified that PyLint has a simple GUI that is shipped with it; it’s called pylint-gui :)) Great! Why is it nowhere mentioned on the project’s home page? I’ve read several reviews too, nobody says it has a GUI… Now I searched for the string “gui” in the manual and yes, they mention it in two lines, but no screenshot! Either you read it word by word or you miss it. To fill the gap, here is my screenshot of the mysterious pylint-gui:

Well, if you prefer minimal design, you can try Pylov :) Otherwise use the official GUI.

Update (20110426)
I made Pylov because the PyLint plugin of the Eric IDE didn’t have the refresh option. I contacted the author of Eric and he added this feature :) So if you use Eric, it is recommended to use the PyLint plugin.

[ @reddit ]

Categories: python Tags: , , , , ,

Write better code with the help of Pylint

April 6, 2011 Leave a comment

Pylint analyzes Python source code looking for bugs and signs of poor quality. Pylint is a Python tool that checks if a module satisfies a coding standard. Pylint is similar to PyChecker but offers more features, like checking line-code’s length, checking if variable names are well-formed according to your coding standard, or checking if declared interfaces are truly implemented, and much more (see the complete check list). …
Pylint is shipped with Pyreverse which creates UML diagrams for python code.” (source)

With the help of Pylint, you can refactor your code so that it better satisfies coding standards. Its usage is dead simple:

pylint hello.py

For more details, see the official tutorial.

Installation:

sudo pip install pylint

Notes:

I’m using the Eric IDE for Python. I was very happy when I discovered that it has a PyLint plugin! You can install the plugin from Eric.

Related

  • lint (lint is the original static code analyzer for C)

Update (20120915)

If you want to see the errors only, call pylint like this:

pylint -E hello.py
Categories: python Tags: , , ,

Pylint

October 16, 2010 Leave a comment

Pylint is a lint-like tool for Python code. It performs almost all the verifications that pychecker does, and additionally can perform some stylistic verification and coding standard enforcements. The checked code is assigned a mark based on the number and the severity of the encountered problems. The previous mark of a given piece of code is cached so that you can see if the code quality has improved since the last check.”

Pylint is a very nice code checker. If you use Ubuntu, you can install it from the repositories (sudo apt-get install pylint). Its usage is very simple:

pylint  file.py

The output is a nice report with suggestions how to improve the code quality. I especially like the “unused import” warnings.

Check out this tiny tutorial for some examples.

Categories: python Tags: , ,