TextReportWriter

Description

The org.codenarc.report.TextReportWriter class (type="text") produces a simple text report of the CodeNarc results.

See a Sample Report.

Option Nested Elements

The option element is a child of the report element and defines a report-specific option for a report.

org.codenarc.report.TextReportWriter supports the following options:

Attribute Description Required
maxPriority The maximum priority level for violations in the report. For
instance, setting maxPriority to 2 will result in the report
containing only priority 1 and 2 violations (and omitting
violations with priority 3).
3
outputFile The path and filename for the output report file. No
title The title for the output report. No
writeToStandardOut Set to "true" or true to write out the report to
stdout (System.out) instead of writing to a file.
No

Example

Here is an example Ant XML build file illustrating configuration of org.codenarc.report.TextReportWriter. Note that the report type is specified as "text".

<taskdef name="codenarc" classname="org.codenarc.ant.CodeNarcTask"/>
<target name="runCodeNarc">
    <codenarc
            ruleSetFiles="rulesets/basic.xml,rulesets/exceptions.xml,rulesets/imports.xml"
            maxPriority1Violations="0">

        <report type="text">
            <option name="outputFile" value="reports/CodeNarcReport.txt" />
            <option name="title" value="My Sample Code" />
        </report>

        <fileset dir="src">
            <include name="**/*.groovy"/>
        </fileset>
    </codenarc>
</target>