How to integrate TODO processing into the maven testing phase?

Suppose I have a project with a lot of todos, some inadvertently stayed there, some are no longer relevant, some represent future possible functions, etc.

I know that most IDEs can show / filter / sort them, but they need to look for a way to apply more stringent policies.

what I was looking for is some maven plugin that I can bind to the testing phase, which searches for a TODO of a certain format (for example, // TODO-Ver ...) and, if any, generates a test error (which will then be displayed via hudson, emails will be sent, alarms will be turned off, heads will roll, etc.).

this additional execution will be tied to the testing phase under some profile, which will be activated only close to the end of the dev loop or something like that.

My question is: has anyone done anything like this before? What code verification tools can be adapted to search for TODO with regexp and which maven plugin can be used to run the specified verification tools? can it be made from unit test? Any comments / ideas / suggestions would be welcome.

+6
java maven-2 todo
source share
2 answers

Checkstyle can do this (see TodoComment check), and you can use the maven checkstyle plugin and its checkstyle:check purpose to check the code and build failure in case (usually in the verify phase).

+3
source share

The checkstyle plugin is already specified, so I will present the Taglist Maven plugin , which searches for TODO, FIXME tags in the source code and can report the use of all such tags . Of course, customizable , so you can put in your own tags for search; regexes also seem to be supported .

+3
source share

All Articles