Graham King

Solvitas perambulum

lintswitch: Automatically run pylint / jslint on your code

lintswitch is a small Bash script that connects:

  1. incron which watches your files
  2. pylint, pep8 and jslint, warn you about possible problems in your code.
  3. zentiy, notify-send, and imagemagick, which display the lint result.

Your code is constantly being watched and linted, in the background, without interrupting your workflow, unless there is an error in your code.

Installing it is easy:

git clone git://
cd lintswitch

It’s on github here: lintswitch at github. Let me know if it’s useful to you.

The story

There’s a story here, about Unix, and software development.

I’ve been wanting something like this for a while. Some months ago I wrote a wxPython program to do this. It worked. Then I read The Art of Unix Programming, and realized I was thinking-in-Windows, by writing one big program. The Unix way is small parts, loosely coupled.

I broke the problem down into sub-problems: I needed:

  1. something to notice when a file changed
  2. something to lint the files
  3. something to display the result

Linting (2), was obvious: pylint, pep8 and jslint (and hopefully more in the future).

For noticing (1) I knew I wanted to use inotify, so incron was perfect.

And for displaying (3), there turned out to be many options. lintswitch uses a combination of Gnome’s notification system, zenity, and rendering text to the root window with imagemagick.

I didn’t need a wxPython GUI. All I needed was some bash script to glue the parts together. And that is lintswitch.