CppNcss Task

Description

This task integrates CppNcss into an Apache Ant build process.
It generates an xml report to a file which in turn can be transformed to an html page with the XSLT task.

In order to use the task it must be defined with a Taskdef.

<taskdef name="cppncss" classname="cppncss.CppNcssTask">
  <classpath>
    <pathelement location="cppncss-1.0.2.jar"/>
    <pathelement location="dom4j-1.6.1.jar"/>
  </classpath>
</taskdef>

Parameters

AttributeDescriptionRequired
tofilethe name of the output fileYes
prefixthe prefix to remove from pathsNo
keepgoingwhether the parsing must keep going instead of stopping upon the first error, defaults to noNo
sortinga list or ordered measurements to perform, defaults to "NCSS,CCN,function"No
samplesthe number of samples to keep, defaults to keep them allNo

Parameters specified as nested elements

  • fileset

    Use filesets to specify the source files to parse.

  • define

    Use defines to suppress define symbols from input while parsing.

    • Parameters
      AttributeDescriptionRequired
      namethe symbol to replaceYes
      valuethe value of the replacement, default to emptyNo
  • macro

    Use macros to suppress macro expressions from input while parsing.

    • Parameters
      AttributeDescriptionRequired
      namethe symbol to replaceYes
      valuethe value of the replacement, default to emptyNo

Examples

<cppncss tofile="cppncss.xml">
  <fileset dir="src"/>
  <define name="WINAPI"/>
  <macro name="BEGIN_COM_MAP"/>
  <macro name="END_COM_MAP"/>
</cppncss>

analyzes all files found recursively under the src directory, with one define and two macro symbols to suppress.

<cppncss tofile="cppncss.xml" samples="30">
  <fileset dir="src"/>
</cppncss>

analyzes all files found recursively under the src directory, reporting only the 30 top measurements.

<cppncss tofile="cppncss.xml">
  <fileset dir="src" measurements="function,CCN"/>
</cppncss>

analyzes all files found recursively under the src directory, keeping only function and CCN measurements and sorting them in this order.