1. 8

  2. 6

    You can use git grep to use grep exclusively against files in your git repository (e.g. it will skip over node_modules, compiled – assuming you don’t commit those)

    1. 2

      A long time ago i tried to solve this problem by writing something that would allow me to list, edit and remove comments like these with a simple tool. Getting it to work everywhere caused me to stop. I like this simple approach. View only. Let the programmer delete the comment.

      1. 2

        An approach I like is to have a convention of attributing FIXMEs and TODOs right in the source, like

        // TODO (mjn 2015-10-31), should handle invalid messages more gracefully

        An advantage of this, vs. attributing authorship via the git authorship attribution, is that people can see the author/date right in their editor while editing the file, instead of having to run an external tool to get the comments matched up with authors. The date is especially nice since you can quickly tell whether this is the kind of TODO where someone is actively working on it, or is a 6-year-old forgotten TODO. You can also jump around looking for your own TODOs using your editor’s normal text-search functionality. Once the codebase has this convention established, people tend to be pretty good about adding their name to new FIXMEs and TODOs, though you can always fall back on the external tool if you find an unattributed one.

        1. 2

          This is a great idea. One other thing to consider is tracking todo comments as part of your CI build with something like the task scanner plugin. You might even decide to fail the build if the number of todos exceeded some threshold.

          1. 1

            I feel like git hooks are not used enough. There is so much you could do with them! Btw, would this still work by commiting from an IDE ? I don’t know if the full output is retrieved when pushing via these “git plugin”

            Also, this script could be 100% POSIX compatible by replacing

            done < <(todo_list)


            todo_list | while IFS= read -r [...]

            allowing the (more portable) use of #!/bin/sh