# <codestats>

[This is preliminary documentation and subject to change.]

Generates statistics from source code.

Scans files in a fileset counting lines.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
append | bool | Specifies whether the results should be appended to the output file. The default is false. | False
buildname | string | An identifier to be able to track which build last updated the code stats file. | False
output | file | The name of the file to save the output to (in XML). | False
summarize | bool | If you only want to show summary stats for the whole fileset | False
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False
unless | bool | Opposite of `if`. If false then the task will be executed; otherwise, skipped. The default is false. | False
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False

### Nested Elements:

#### <counts>

Set of line counters to enable.

##### <count>

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
label | string | The label to apply to the results. | True

### Nested Elements:

#### <fileset>

The set of files to work on.

#### </fileset>

##### </count>

#### </counts>

### 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>

### Requirements

Assembly: NAnt.Contrib.Tasks (0.93.5002.0)