Day 2 - Nuke some TODO comments

Gotcha, thanks for the explanation.

14 @TODOs found across all bundles -> 10 deleted, 4 created as low prio tickets.

Just realized how much faster inline @TODOs are to create. Would be nice if I could create my gitlab issues right from the command line or even better convert and remove inline @TODOs on push.

Note: IntelliJ/Webstorm/PHPstorm has a TODO tab that automatically lists all TODOs and FIXMEs in your code-base (Cmd+6)

An argument that came up when discussing this in our team was this: It’s actually nice to see a todo in the code sometimes, because then you know that someone else has thought about this thing, whatever it might be. We’re going to keep todos in our code, but have the requirement that all todo comments must have a link to a task in trello.

2 Likes

Not too many TODOs (about 10), but managed to get rid of all of them. A sizeable fraction were basically “This branch should never happen, but if it does I’m not sure what to do”. The answer was fairly clear: log a message with our error tracking service (we use Sentry, but plenty of others are available).

Most embarrassing TODO: it was the entire content of the LICENSE.txt for one of the library gems from my current project!

Only 5 TODOS. The oldest one was a year old.

Now I’ve created issues for them and removed 4 from the text.

The 5th is in a translation file and translates something into Spanish that is currently not used/needed in Spain. I still left it as TODO because I wasn’t sure what else I should do with it… I don’t have the Spanish translation yet and if I ask my spanish colleagues to translate it for me, they will want the feature in Spain too, and I don’t have the resources to implement that right now.

I don’t know which one is the oldest. But probably around 4 years, when the project started.
But here are some interesting cases:

  • TODO in deprecated code - removed with the code!
  • todo method on the model ))
  • TODO that is already implemented three lines below
  • the most funny TODO: remove this file

Half of the todos turned into PM tasks. One is left in the code :(.
This is really cool task to sweep some trash!

That’s not bad! I often have a bunch of dependency TODO comments show up with a search like that, so I’ve started using git grep instead, which only searches working tree files.

I keep all my repos in a common directory, so I use a simple script to collect all the TODOs:

#!/bin/sh
#
# A command to count TODOs in all repos (sub-folders)
# in the given folder.
#
# USAGE
#  $ ./todo_these_repos
#
for directory in $(ls -1 -d */); do
    echo "\n== counting TODOs: $directory ==\n";
    cd $directory;
    git grep --color 'TODO:'
    cd - > /dev/null 2>&1;
done

About 150 TODO comments overall :fearful:, many of which are 10+ years old. I deleted a couple from 2007 that related to features that have never been requested. I’m looking forward to discussing with my team how to chip away at these going forward.

About 50 TODOs across both of our applications. Happily, most of them are already ticketed. Amusingly, one TODO was cut and copied into different apps. Easy to get rid of. :smile:

Had only 12 TODO items. Completed two of them, 4 were not needed (had it in to remind me to code that function and forgot to take it out), and the rest were for sections of code that were not used any more, so just deleted the entire sections! Horray!

I was surprised I didn’t find more, but I only had time for a few of our several repositories. The oldest was from over 4 years ago, and was simply a ‘todo: implement this’ on an empty function.

image
Ouch… definitely more than 20 minutes required for this one, worth the effort though! Unfortunately, this is only 1 of 139 repos my company uses, definitely going to have to recruit more folks into this.

Found one like this:

/** FIXME I know this ... is stupid, but I just need this here now
 *  I'll sort this mess out next week, I promise */

Ran git blame on it, and it was by me… sometime in 2015 :confounded:

Fix was long overdue on that one.

1 Like

I found a lot more than I remembered — 30 total — and they were mostly in code I wrote. I took care of 5 of them. The ones not by me are almost all in stylesheets, some of which I’ve probably never even looked at before.

I converted 15 of 56 TODOs to issues, and deleted 7 of 7 FIXMEs as out-of-date. The oldest was from July 2015.

1 Like

Oldest: 2010.

Didn’t get nearly all of them, but tackled 19 (got a few together because they were identical comments on identical code noting that they should be extracted to one place later).

@dodecadaniel thanks for sharing rake notes. Didn’t see it until after I did, but it’ll be great to use when checking other projects.

Only two for the project I looked at today. Ended up using most of the 20 minutes trying to figure out if we could delete the code the TODO said to delete at some point :confounded:.

Found some! And removed them in favour of a comment in the relevant issue that would solve them https://github.com/consul/consul/pull/2083#issuecomment-356441219

1 Like

This one was hard :grimacing: Found 100 TODOs and 20 FIXMEs. Spent a lot of time figuring out the original context of some of them by looking through git blames & history.

In the end I created a task to continue the process, removed 8 easy ones and created and completed a task that addressed two other TODOs. I went way over the 20 minutes though :sweat_smile: