Bazaar Stale Comments Plugin

I find myself regularly coming across comments on code, that I have written, that are cripplingly misleading and this is almost always due to them becoming stale over time. Comments become stale if the code they are describing is changed without the comment being updated, something I am often guilty of.

To try and reduce the impact of this I have started implementing a plugin for the Bazaar version control system that runs when I try to make a commit. The goal is to have it look through changed files for comments and docstrings, and if these comments are marked as valid for an old revision check to see if the code they relate to has changed - if it has fail the commit.

The current version is pretty limited and can only cope with docstrings of the form:

def greeting():
    """RevNo: 12
    Say hi to everyone.
    print "Hello World"

If there is a change to that function in a revision later than 12 the plugin will fail the commit.

I am having a go with hosting the code on launchpad under the name Stale Comments Plugin

Posted on 19 Jun 2008
With thanks to