Ensure ToDos get ToDone

10 February 2016, by

It is very common to write ToDos in code. This makes sense. You’re working on a piece of functionality and suddenly remember something relevant, but slightly off topic, which needs to be done. So you add a ToDo. Brilliant, you’ve successfully not shaved any yaks.

But when will you actually get around to finishing off the ToDo? How urgent is it? Will you remember that the ToDo is there when you do get around to implementing that extra functionality?

There are some Jenkins plugins that will help you remember that you’ve got ToDos to do, and display how many remain in a nice graph. However, will this be enough to make sure that the work ever gets ToDone?

On a recent project, we kept finding that ToDos were being left behind, and so came up with a new ToDo checking script, which we think is much more effective at ensuring everything you expect to be done in your project is.

The JIRA ToDo checker

The JIRA ToDo checker is a simple python script that is run on every code base checkin and performs the following actions:

  • Grep the codebase for any lines that mention ToDo.
  • For any “TODO: <JIRA-CARD>” add a comment to that card, referencing the line of code the TODO is on (using a Gitlab link).
  • For any removed TODOs, remove comments from the relevant JIRA card.
  • Create a list of any TODOs that do not reference JIRA cards, and note down who committed them.

A build will fail, and people will be sent an email if:

  • They closed a JIRA card that still had TODOs on it.
  • They added a ToDo that did not reference a JIRA card.

Simple! Now we can be sure that any ToDos are centrally tracked, and will be picked up by a developer as soon as they start working on relevant work. Also, we can be confident that at the end of the project, when all of our JIRA cards are closed, all of our ToDos have been resolved.

This technique has worked wonders on our codebase, and I would highly recommend other teams set up something similar.

Tags: , , , , , ,

Categories: Technical


Leave a Reply

* Mandatory fields

− 3 = three

Submit Comment