CodeStatsTask Class

Summary

Generates statistics from source code.
Assembly
NAnt.Contrib.dll
Namespace
NAnt.Contrib.Tasks
Base Types
  • Task
graph BT Type-->Base0["Task"] Type["CodeStatsTask"] class Type type-node

Syntax

[TaskName("codestats")]
public class CodeStatsTask : Task

Examples

Generate statistics for a set of C# and VB.NET sources, applying different labels for both.

    <codestats output="test.xml" append="true" buildname="MyBuildName">
    <counts>
        <count label="C#">
            <fileset>
                <include name="**/*.cs" />
            </fileset>
        </count>
        <count label="VB">
            <fileset>
                <include name="**\*.vb" />
            </fileset>
        </count>
    </counts>
</codestats>

Generate statistics for all C# sources and only output a summary to the log.

    <codestats output="test.xml" verbose="true" summarize="true">
    <counts>
        <count label="C#">
            <fileset>
                <include name="**\*.cs" />
            </fileset>
        </count>
    </counts>
</codestats>

Remarks

Scans files in a fileset counting lines.

Attributes

Type Description
TaskName

Properties

Name Value Summary
AppendFile bool
Specifies whether the results should be appended to the output file. The default is false.
BuildName string
An identifier to be able to track which build last updated the code stats file.
CodeStats CodeStatsCountCollection
Set of line counters to enable.
OutputFile FileInfo
The name of the file to save the output to (in XML).
Summarize bool
If you only want to show summary stats for the whole fileset

Methods

Name Value Summary
ExecuteTask() void