Home > python > Write better code with the help of Pylint

Write better code with the help of Pylint

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: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 94 other followers

%d bloggers like this: