|
Project Information
Featured
Downloads
Links
|
Ant TODO is an Apache Ant task for parsing TODO comments from source code In most projects, you'll routinely see //TODO: reimplement with x, y & 7!! dotted around the place. The problem with these is that they rarely get exposure, nor do they actually get removed or even implemented. This Ant Task is designed to produce a file containing the TODOs in all source files specified in any amount of given folders. Why?For a long while I thought this might be a useful tool to have. Working with code-bases large and small didn't matter: you'd often find TODOs or FIXMEs dotted around the place, with little regard from the developer as to whether they'll ever get dealt with. You might suggest removing them is a good idea, but that in itself is a process that requires some analysis and investation of the code; not to mention the need to find them in the first place. So various times I would scour the web looking for something to highlight the TODOs for my projects yet I could never find anything that would do it quietly or easily. Thus, I often came to the conclusion that I should code one myself. The search continued. Projects like Checkstyle can provide the functionality, but that requires a greater understanding of that framework, not to mention the time (thus cost) investment it might take to implement not only its use but to dig out the TODO rule. I searched high and low and felt there wasn't anything simple enough. Not all software shops use checkstyle; it's likely most use Ant. So the 2009 festive season for Christmas arrived and with a week off and plenty of food and drink lieing around I decided to attack this problem myself. Thus Ant TODO was born! Not Just for Java!Ant TODO has been proven to work with .as (ActionScript), .c and .h, as well as .sh files - it supports comments such as # TODO, /* TODO ...*/ and so-on - so if you're not a Java shop, fear not: you can still use Ant TODO for your C, Python, shell or ActionScript code. How does it work?Ant TODO extends the simple Matching Ant Task which allows you to pass includes elements so you can parse multiple source trees: <todo dir="test-src"><!-- the dir to parse --> <include name="**/*.java" /><!-- include all Java files --> </todo> As well as the above, you can write to a specific file or to stdout which allows you to record output using continuous integration tools like Cruise Control. RequirementsOne of the goals of this pet project was to ensure efficient, unobtrusive and simple integration. As such, the only requirement is Java 1.5 or above. Getting StartedThere's a complete getting started guide available, but to get it running in seconds all you have to do is: <!-- Define the classpath holding ant-todo.jar --> <path id="classpath.todo"> <path location="/path/to/ant-todo.jar"/> </path> <!-- Now define the TODO task --> <taskdef name="todo" classname="org.atc.tools.ant.TODOTask" classpathref="classpath.todo" /> <!-- Now call the todo task --> <target name="list-todo"> <todo dir="src"> <include name="**/*.java" /> </todo> </target> Simple! Even Ant TODO uses Ant TODOIn the build.xml script we have the following jar target: <target name="find-todos-in-ant-todo">
<taskdef name="todo" classname="org.atc.tools.ant.TODOTask">
<classpath>
<pathelement path="ant-todo.jar" />
</classpath>
</taskdef>
<todo dir="${dir.src}" verbose="true" outfile="ant-todo.todo">
<include name="**/*.java" />
</todo>
</target>which is like an intrinsic smoke test! All we do is a simple: <antcall target="find-todos-in-ant-todo" /> in the jar target and boom, we have instant visibility to what the latest TODOs in the code are. |