But like you said...you could always use fgrep (and most of us probably don't have "TODO" outside of comments anyways).
But like you said...you could always use fgrep (and most of us probably don't have "TODO" outside of comments anyways).
However it should be noted that regex isn't the right tool for parsing source code to begin with. There could be instances in that code where false positives are matched. And there are already known instances where positives are missed (namely "//" comments). So if you really want to exclude anything that isn't a comment then the only accurate way to do so would be full source code parsing. Failing that, it's better to match all instances since "TODO" generally isn't a string that occurs frequently outside of comments (unless it's a visual prompt to the user, eg
alert('TODO: this feature hasn't been implemented yet')
but in those instances you'd want the source code captured as well).Even if you build that tool (which handles many languages) - it has an extra headache cost with the parsing time, which might be really slow for large projects.
I actually started Leasot with Javascript AST checking which never misses TODOS but is very hard to extend to other languages, as well as parsing speed was a magnitude slower.
This isn't a dig, it's just something I've genuinely never stumbled across in 2 decades of programming so wondered if there's a culture out there I've missed.
This TODO scanner project is completely, utterly, pointless.
There are probably other use cases, but overall, if cli regex works great for you, stick with it.
Regarding if Leasot is pointless or not, well everyone is entitled to their own opinion (kazinator). In the greater sense I guess the world needs more todo doers than todo parsers ;)
TODO comments could automatically be turned into action items, against the developer who introduced them (git blame!)
The software could be intelligent enough to uncover relationships among the TODO's, and schedule a meeting for specific subsets of TODO's, calling in all the relevant peo^H^H^H stake holders.