ArticlesEngineering

Codo: TODO comment tool

The CLI to search, manage, format, and validate your TODOs

Check out codo, my new CLI program to search code comments, modify them, export them, validate them, and format them.

TODO comments as the task list

I use a bunch of TODO comments as I work. They are great for keeping track of work in context, much more than a tracking ticket floating off in the distance. As projects grow, the TODOs can get a bit messy. Not every TODO is urgent and are fine to sit incomplete for ~ever. Some are just waiting on some external thing to happen, e.g. a code/data migration of some sort. As these TODOs build up, it becomes hard to manage.

Codo is an attempt to keep TODOs working for longer at scale. While I'll be using it for personal projects where it is just me working on things, it has all the features needed for a team of people to use it together. It's a command line tool you can also tack on to your CI jobs to keep TODO hygiene/consistency in a repository.

While it's hard to pick a favorite feature, my top three are:

  • Exporting the TODOs as JSON. I think this is going to enable a lot of cool follow-on workflows like due date reminders and other admin tooling.

  • Formatting TODOs. It's fine in my personal projects, but lots of folks have different ways of writing TODO comments. With one script run I can reformat all TODOs into the proper format. Very handy just like code formatters.

  • And with formatting we also have the non-modifying feature: validating (aka linting). This is really slick and lets you enforce TODO consistency. Perfect for folks like me who just wanna get it setup once and let the tooling do the enforcing.

I hope Codo can keep me out of issue trackers for a good long while by giving TODO comments superpowers.

Written in Rust

This is my first Rust crate. Having written only a few Rust programs so far, this is my largest. I was happy to reuse some of the crates underlying ripgrep to build this program. I chose Rust because I wanted the CLI to be really fast and responsive just like ripgrep and it worked out pretty well without needing to optimize the code too much.

I did not find the Rust borrow checker to be too daunting but I did clone/copy/take ownership when things got a bit exotic. All in all a good adventure!