Package net.sourceforge.pmd.cpd
Class CSVRenderer
java.lang.Object
net.sourceforge.pmd.cpd.CSVRenderer
- All Implemented Interfaces:
CPDReportRenderer
- Direct Known Subclasses:
CSVWithLinecountPerFileRenderer
Renders a report to CSV. The CSV format renders each match (duplication)
as a single line with the following columns:
- lines (optional): The number of lines the first mark of a match spans.
Only output if the
lineCountPerFileis disabled (see ctor params). - tokens: The number of duplicated tokens in a match (size of the match).
- occurrences: The number of duplicates in a match (number of times the tokens were found in distinct places).
Trailing each line are pairs (or triples, if lineCountPerFile is enabled)
of fields describing each file where the duplication was found in the format
(start line, line count (optional), file path). These repeat at least twice.
Examples
Example without lineCountPerFile:
lines,tokens,occurrences
10,75,2,48,/var/file1,73,/var/file2
This describes one match with the following characteristics:
- The first duplicate instance is 10 lines long;
- 75 duplicated tokens;
- 2 duplicate instances;
- The first duplicate instance is in file
/var/file1and starts at line 48; - The second duplicate instance is in file
/var/file2and starts at line 73.
Example with lineCountPerFile:
tokens,occurrences
75,2,48,10,/var/file1,73,12,/var/file2
This describes one match with the following characteristics:
- 75 duplicated tokens
- 2 duplicate instances
- The first duplicate instance is in file
/var/file1, starts at line 48, and is 10 lines long; - The second duplicate instance is in file
/var/file2, starts at line 73, and is 12 lines long.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final char -
Constructor Summary
ConstructorsConstructorDescriptionCSVRenderer(boolean lineCountPerFile) CSVRenderer(char separatorChar) CSVRenderer(char separatorChar, boolean lineCountPerFile) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sourceforge.pmd.cpd.CPDReportRenderer
renderToString
-
Field Details
-
DEFAULT_SEPARATOR
public static final char DEFAULT_SEPARATOR- See Also:
-
DEFAULT_LINECOUNTPERFILE
public static final boolean DEFAULT_LINECOUNTPERFILE- See Also:
-
-
Constructor Details
-
CSVRenderer
public CSVRenderer() -
CSVRenderer
public CSVRenderer(boolean lineCountPerFile) -
CSVRenderer
public CSVRenderer(char separatorChar) -
CSVRenderer
public CSVRenderer(char separatorChar, boolean lineCountPerFile)
-
-
Method Details
-
render
Description copied from interface:CPDReportRendererWrite out the contents of the report to the given writer.- Specified by:
renderin interfaceCPDReportRenderer- Parameters:
report- The report to writewriter- A writer for the report file- Throws:
IOException- If the writer throws
-