Tag Archives: FIXME

Joel Leclerc: extract-xxx – An easy way of extracting XXX/TODO/FIXME’s

First: The “Why”. Well, it’s because when I write code, I usually don’t have the time (or the patience) to write everything perfectly, so I usually just write in a small TODO or FIXME for later. The issue is, when I do want to fix them (e.g. in the final polishing stage of development), it’s hard to find them (especially if you have many source files, and it takes some time to open any of them). Also, it’s because I wanted to learn perl, and I wanted to take a small break from my other project (which is taking up most of my free time).

The repository is here: https://github.com/MiJyn/extract-xxx. Download it however you want, then run extract-xxx.pl.

What it basically does is that it searches through a file for the “comment types” (which is just a name I assigned for things like “XXX” or “TODO”, since I don’t know that they’re really called), and then prints them with (by default), 2 lines of context, both before and after. It’s kind of like grep, but it’s a bit more specialized towards this task (though you could theoretically do everything this does by fancy utilization of grep, find, and nl).

Example usage:

$ ./extract-xxx.pl
./README.md

 48  | An incomplete list of limitations would be:
 49  | 
>50>>|  * It doesn't do any lexical parsing, so if you wrote `XXX:` in a string or something else (not a comment), it would still report it. Though it's also somewhat of a feature, as then it supports any language
>51>>|  * It requires a colon (`:`) after a comment type (i.e. you have to write `XXX:` instead of `XXX`)
 52  |  * The `-x` option just places whatever you put in a `m/.../` without any kind of processing. Therefore, don't expect things to go too well if you added some kind of weird scripting stuff (or a `/`).
 53  |

When run with no arguments, it will recursively go through the current directory (including sub-directories, and sub-sub-directories, etc…), and will then go through each file, as mentioned previously. As you can notice, lines 50 and 51 are highlighted (by >50>>), as they contain a “comment type” (in both cases, XXX), proceeded by a colon.

Instead of rewriting everything here, check out the repository, as the README explains pretty much everything you need to know about it.

Anyways, let me know what you think, any constructive criticism is appreciated

Source: FULL ARTICLE at Planet Ubuntu