Day 2 - Nuke TODO comments

Congrats on making it to day 2!

Today’s exercise is short and sweet: grep your codebase for TODO comments.

When you find one, I recommend you do one of the following:

  1. Is it out of date? Delete it.
  2. Is it still relevant? Delete it and add it to whatever system you use to track work to be done, like GitHub Issues or Trello or Asana.
  3. Are you unsure? Do a little research and/or track down the comment’s author and get an answer. Then do 1 or 2 :).

Why do this? Because code is a lousy place to track todos. When a todo lives in your code, it can’t be prioritized or scheduled, and tends to get forgotten.

For extra points, submit a PR that deletes all the TODO comments and include links to the newly-created issue for each one. Should make for an easy review/approval.

Worth noting: spend 20 minutes on this task and then declare victory. Success is showing up and putting in the time, not necessarily deleting every comment. If you can only delete one comment in 20 minutes, you’ve still succeeded for the day (well done!)

Finally, when you’re done, please share how old the oldest TODO comment you found.

Get to it!

2 Likes

Hi! I know I’m a day early, but it is a quiet day, and I wanted to share this little script ahead of TODO day in case it helps anyone else finding all of their TODO like flags.

rfluff - Find all those TODO/FIXME/HACK/etc. · GitHub

Adapted from a friend’s similar perl script from almost, oh my, 2 decades ago, this little script has been following me around in my bin dir for years. It could probably be re-written as a complex egrep, but rfluff is easier to type.

This will search

  • extensions: (rb,erb,haml,coffee,rake),
  • specific files: (Rakefile, Gemfile, Guardfile)
  • and ignoring (node_modules, tmp).

As a bonus, if you run it with -qf you get vim compatible quickfix output. So for vim users:

command! Rfluff cexpr system('rfluff -qf ' . shellescape(expand('%:r')))|:cw

Side note: Depending on your codebase and team, though I haven’t included them by default here, I have found that adding a few swears into the tag list can find things that perhaps ought to have been TODOs.

3 Likes

Good morning!
I did it, first thing this morning.

Nuked 4 commits, created tickets for 2, and the other 2 actually annotated code that was deprecated anyway. Not only could I remove the todos, but also the code it was accompanying. :muscle:

Then I bundled this in a nice Pull Request, which is awaiting review.

1 Like

I had only 1 todo stored in the codebase of a client project. So I used the time to actually do it, in retrospect I should’ve taken 30 min extra right away when I wrote down the todo. Overall, great tip to not store todo’s in your code. For me it’s one of those things I know its not the smartest thing to do and then I still do it :sweat_smile:

Good morning everybody!

I checked four repositories and found no TODO comments. So while I couldn’t create any tickets I still gave myself a pat on the back :smile:

2 Likes

I found three TODO comments:

  1. August 2016: Deleted as it wasn’t relevant anymore.
  2. November 2017: Fixed as it was a quick fix with one line.
  3. August 2020: Deleted as we already had a Jira issue for it (the TODO comment even mentioned that).

Pretty nice to get cleaned up even though it was only three.

31 in matured client project. Nuked half, created task for others.

Found 3 todos which were irrelevant, so I went ahead and sniped them!

I cleaned up a total 18 TODOs in 17 files.

Most could just be removed, as the code was either:

  • Not in use anymore (and could be deleted, jay!)
  • Tested elsewhere (and this todo in the test was not required)
  • Simply not worth doing because the issue never showed up (3 years later)
  • Suggestions for improvements that turned out to be worthless because the requirements for that feature never changed

Oldest TODO was from 2017, and the code could be deleted.

Morning!

We have a rule that all TODOs have to be tagged with either a username (e.g. TODO(jackfranklin)) or a bug (TODO(crbug.com/X)) - so most of ours are fairly well organised. I managed to find one that I’d assigned myself which is now obsolete and won’t be done, so I removed it.

1 Like

Done, I removed 14 TODOs and the oldest one was from January 2017.

I always told teammates to avoid TODOs whenever possible for the same reasons the OP mentioned. This could easily be a custom Rubocop rule by the way: I’ll add that to my… TODOs. :wink:

I generally don’t find TODOs totally useless, so I didn’t try to remove them all. But I was still able to remove 3 of them that were not relevant and to address 3 others. So that’s nice :slight_smile:

Good morning!

You probably won’t believe me when I say that knowing this is bad practice, I never put any TODO comments in my code (well, aside from my org-agenda files, but there they have a special meaning :sweat_smile:

So I did a grep on my projects folder, and got a myriad of hits from all the node_modules folders.

A more refined search:

grep -orn --exclude-dir=node_modules --exclude-dir=test --exclude-dir=spec --exclude-dir=vendor --exclude-dir=babel-loader-node-modules . -e "TODO"

took a good part of the 20 minutes, but found some TODOs in gemspecs, which I nuked …

Victory! :v:

Had zero TODO comments in the codebase cause I already use The ToDo inbuilt app of ubuntu to keep myself organized. The org in which I contribute the most has a shared Google Doc for ToDo tasks.

Looking forward to the next day :slight_smile:

Hello everyone!

I’m switching to a new project today so taking care of TODOs is my parting gift :grin: I have created 5 issues for them.
It is also a real ‘treat’ when you find a TODO mentioning that ‘something should be done when time is less pressing’. Oh you sweet summer child, when will you learn :grimacing:

Have a great day :slightly_smiling_face:

2 Likes

I didn’t find any TODO comments in my repository. Looking forward to the next challenge.

Funily enough, I didn’t have any “TODO/FIXME/HACK” or similar comments, but I was using context.TODO() in one of my main projects, somewhere that deserved to have the context properly implemented.

So at first I created an issue to properly implement context in that part, but it kept bugging me, and now that whole pkg has been refactored to use contexts properly. YAY!

Such a great way to start the day! Even though it was only 3 TODO’s that were removed, it still felt great to have something done from the get go!

All three comments referenced either outdated content, or something that’s not irrelevant or redundant to the current state of the project. :smiling_face_with_three_hearts:

Thank you so much for this!

Oooh, thank you for sharing rfluff! Really well written, and was easy peasy to modify to work for PHP. :partying_face:

My best one was one from 2016: // TODO: comment this function. I just nuked it, function was self-explanatory.
Nothing found that needed a task. I found a couple of interesting ones that said: // TODO: refactor this from 2017. I guess since the code didn’t need to change, there is probably no need to refactor it.

2 Likes