Class CSVRenderer

  • All Implemented Interfaces:
    CPDReportRenderer
    Direct Known Subclasses:
    CSVWithLinecountPerFileRenderer

    public class CSVRenderer
    extends Object
    implements CPDReportRenderer
    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 lineCountPerFile is 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/file1 and starts at line 48;
    • The second duplicate instance is in file /var/file2 and 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.
    • Constructor Detail

      • CSVRenderer

        public CSVRenderer()
      • CSVRenderer

        public CSVRenderer​(boolean lineCountPerFile)
      • CSVRenderer

        public CSVRenderer​(char separatorChar)
      • CSVRenderer

        public CSVRenderer​(char separatorChar,
                           boolean lineCountPerFile)