My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads

NAnt TODO

A Task for NAnt to parse a projects source code and generate a report.

Comments

The task automatically identify comments in the following style

//TODO: First Test to do Item
//FIXME: First Fix me Item
//HACK: First Hack Item

Additional matches can be made by adding in Token elements to the NAnt task.

Sample

<ToDo source="path/to/source" output="report.xml" searchpattern="*.cs;*.txt">
    <Tokens>
        <Tokens Value="BUGFIX" />
    </Tokens>
</ToDo>

Output

<ToDo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Items>
    <Item>
      <Message>First Test to do Item</Message>
      <File>NAnt.ToDo\ToDoTask.cs</File>
      <Line>0</Line>
      <Type>TODO</Type>
    </Item>
    <Item>
      <Message>First Hack Item</Message>
      <File>NAnt.ToDo\ToDoTask.cs</File>
      <Line>0</Line>
      <Type>HACK</Type>
    </Item>
    <Item>
      <Message>First Fix me Item</Message>
      <File>NAnt.ToDo\ToDoTask.cs</File>
      <Line>0</Line>
      <Type>FIXME</Type>
    </Item>
  </Items>
</ToDo>

Cruise Control Xsl

Below is a basic xsl style sheet that can be used with CruiseControl .NET to display the output from NAnt.ToDo.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html"/>
  <xsl:param name="applicationPath"/>
  <xsl:template match="/">
    <div id="ToDo">
      <div id="Summary">
        <table class="section-table" cellspacing="0" cellpadding="2" border="0" width="98%" >
	  <tr>
		<td class="sectionheader" colspan="4">ToDo List</td>
	  </tr>
	    <tr>
		<th>Type</th>
		<th>Message</th>
		<th>File</th>
		<th>Line</th>
	    </tr>
            <xsl:for-each select="//ToDo/Items/Item">
              <tr>
                <td>
                  <xsl:value-of select="Type/text()"/>
                </td>
                <td>
                  <xsl:value-of select="Message/text()"/>
                </td>
                <td>
                  <xsl:value-of select="File/text()"/>
                </td>
		<td>
                  <xsl:value-of select="Line/text()"/>
                </td>
              </tr>
            </xsl:for-each>
        </table>
      </div>    
    </div>
  </xsl:template>
</xsl:stylesheet>
Powered by Google Project Hosting