Tag Archives: bazaar

Bazaar Style Checker 0.1.1 released

I’m pleased to announce that Bazaar Style Checker 0.1.1 is now available. Get it at Launchpad. This is a bugfix release:

  • Handle paths with whitespace in style_checker_command. See the README file for details on configuration for this.
  • Workaround for annoying but harmless warning on Windows when trying to remove a temporary file.

Hopefully it won’t take too long before 0.2 is released with some new features. I’m planning to add support for a configuration file to be committed to the branch, similar to .bzrignore. If such a file (.bzrstylecheck) exists, that file will be used as configuration for that branch. If not the configuration locations valid in 0.1.x will be used. Not sure about the format of .bzrstylecheck yet, but I will add support for different commands depending on file type, something that’s not possible for the same branch with todays’ configuration.

Update: There seems to be a a draft for a specification suggesting that such configuration files should be put in a directory called .bzrmeta. Bazaar Style Checker will of course follow this convention.

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.