suppose i have a project with lots of todos, some unintentionally left there, some no longer relevant, some represent future possible features etc.
i know that most IDEs can show/filter/sort them, but im looking for a way to enforce a more strict policy.
what im looking for is some maven plugin that i can bind to the test phase that looks for TODOs of a specific format (for example //TODO-Ver ...) and, if any are found, generates a test failure (which would then be visible via hudson, emails will be sent, alarms would go off, heads will roll etc).
this extra execution would be bound to the test phase under some profile that will only be activated close to the dev cycle end or something.
my question is has anyone done anything like this before ? what code inspection tools can be tailored to look for TODOs by regexp, and what maven plugin can be used to run said inspection tools ? is it possible to do from a unit test ? any comments/ideas/suggestions would be welcome.
Checkstyle can do that (see the TodoComment check) and you could use the maven checkstyle plugin and its checkstyle:check
goal to check the code and fail the build in case of violation (usually during the verify
phase).
The checkstyle plugin has already been pointed out, so I'll introduce the Taglist Maven plugin that looks for TODO, FIXME tags in the source code and can produce a report of the usages of all such tags. Of course, it is customizable, so you can put in your own tags to search for; regexes also seem to be supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With