Menu

Change report output

2015-10-30
2015-11-01
  • Matt Swartz

    Matt Swartz - 2015-10-30

    I'd like to modify CPD to only spit out the "Found a X line (Y tokens) duplication in the following files: ... " when generating a report, i.e. supress the source lines of code. I have the /src/ files and attempted to modify SimpleRenderer.java in /src/net/sourceforge/pmd/cpd/ by commenting out

              String source = match.getSourceCodeSlice();
    
              if (trimLeadingWhitespace) {
                  String[] lines = source.split("[" + PMD.EOL + "]");
                  int trimDepth = StringUtil.maxCommonLeadingWhitespaceForAll(lines);
                  if (trimDepth > 0) {
                      lines = StringUtil.trimStartOn(lines, trimDepth);
                  }
                  for (int i=0; i<lines.length; i++) {
                      rpt.append(lines[i]).append(PMD.EOL);
                  }  
                  return;
              }
    

    However the report has not changed. I'm a bit of a Java noice, so keep that in mind. Do I need to rebuild the pmd-4.2.x in Eclipse somehow?

    Thanks in advance!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.