Code style plugin for Bazaar

For some time ago I discovered this awesome code formatting tool called Uncrustify. I really believe that a consistent and aesthetic looking source code improves readability a lot. So after playing around with Uncrustify’s many settings and seeing how it could improve my code I wanted to integrate it tighter into my work flow. Since I use Bazaar as my main revision control system, it was natural to look at a Bazaar plugin. And of course, not only for using Uncrustify, but whatever source code beautifier you prefer.

So this is the first release of the Bazaar Style Checker Plugin, version 0.1.0. The main features included in this release are:

  • A commit-hook that checks if modified files violates a defined coding style.
  • The commit will fail or just print a warning if violations occur, based on your configuration.
  • An external program is used to check the code style. The command to run is configurable.
  • A new command “bzr style-check” to fix the code style for one file, only modified or for all files.
  • Simple backup routine for files that are fixed.

The way the plugin works is very simple. In order to check if a file violates the defined style, it simply runs the original file through the external program and compares the resulting beautified file with the original file. If there is a difference between the new and the original file, the conclusion is that there is at least one code style violation.

For more information on the features and how to configure the plugin, you should take a look at the README file.

To install the plugin, get the latest release and extract it your Bazaar plugins directory (e.g. “~/.bazaar/plugins”) or get the latest code from trunk:
bzr branch lp:bzr-style-checker stylechecker

For feature request and bug reports, please use Launchpad.

About these ads

One response to “Code style plugin for Bazaar

  1. Pingback: Ali Sabil (asabil) 's status on Wednesday, 26-Aug-09 11:55:40 UTC - Identi.ca

Leave a Reply

Fill in your details below or click an icon to log in:

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