Day 2 - Nuke some TODO comments


#28

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

#29

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.


#30

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:


#31

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!


#32

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.


#33

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.


#34

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.


#35

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.


#36

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


#37

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).


#38

@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:.


#39

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


#40

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:


#41

Learned a few things about this one:

  • listen to the advice about doing the activity as the first thing you do in a day. I came into work this morning & did a task around upgrading servers thinking it’d only take an hour or two, and it ended up eating my entire morning, had meetings in the afternoon, and another issue arose, so didn’t get to the challenge until this evening (it’s almost 8:30PM local time as I write this).
  • it’s interesting how TODOs evolve over time – we had a few TODO’s that were things like “TODO: add A, B, and C” but the TODO was now “TODO: add A” as B & C had been addressed over time, but the TODO no longer had context without the B & C in the TODO. When addressing part of a TODO, if you can’t address the entire thing make sure that the TODO still has meaning otherwise kill it.
  • a couple of TODOs I killed by adding a few unit tests.

Great little activity.


#42

I’m running a little behind - playing catch-up today! :slight_smile:
We had 41 TODOs in our main app. I was able to convert 12 into issues (some were shared interests, so it ended up being only 5 new tickets!), and outright delete another 7 of them as unnecessary/out-of-date/"wtf"s (Example: # TODO: What is this?)

Love seeing a 50% decrease in unnecessary bits! I also (maybe irony, here?) assigned a couple coworkers to the PR I submitted removing the TODOs and suggested they try tackling the remaining 21. I’d love to get more of my team involved in this process - we can make that 20 minute timebox way more effective.


#43

(Also running behind with fires earlier in the week.)

Thanks @stianlagstad for the start! You led me to find/modify the following command (from StackOverflow) to be useful:
git grep -il TODO | xargs -n1 git blame | grep -i TODO

My (painful) results:

  • 124 TODOs going into this.
  • ~41 from our own (known-to-be-lower-code-quality) framework
  • 4 are the Spanish / Portuguese word “todo” (“all”)
  • Oldest: 2013-12-28 (within the first 3 weeks of the project…)
  • Newest: 2018-01-09 (uncommitted! That’s actually something I do, but now I want to set up a commit hook to catch it…)

Thoughts: this was a really useful thing to even just think about – I’ve now added a TODO to my To Do list (instead of code) to really spend some time cleaning up the ones I wasn’t able to quickly decide on.


#44

Main project I looked at today is only me and not the biggest fan of TODO / L8R work either. But I still found 10 TODO comments from various stages.

Rather than adding them to the issues list, I decided to just delete and since most were “do this better later” comments. I will refactor that stuff as I touch it later in a “make it better than you found it” way.

Looks like my earliest TODOs were the first month of the project, about 4 years ago.


#45

I was able to tackle two main TODOs, one that was moving a file to a more consistent place.

Another was to convert a reference to a “carrier” to be a single and unified type through out our app. The latter was much more difficult and time consuming. It ended up taking more than 20 min, so paused and opened up a peliminary PR to come back to.

  • 156 TODOs
  • Most of them old and from a previous team. I am guilty of maybe ~10% of them.

Didn’t get a chance to ticket them. A lot look like they will be wiped out in the coming months since we are doing a lot of refactoring right now.


#46

Only 2 TODOs in the same file.
The oldest was from 2017-03-30:

# TODO: Refactor

The other was:

# TODO: Create spec check

#47

Killed a total of 10 TODOs across 2 repos :). That felt good :sunglasses:

Only one was relevant and moved to issue tracking, the other 9 were outdated.