Examples of PmdReportListener


Examples of org.apache.maven.plugin.pmd.PmdReportListener

   private Report computeReport( final FlexPmdViolations pmd )
   {
      final Report report = new Report();
      final RuleContext ruleContext = new RuleContext();
      final PmdReportListener reportSink = new PmdReportListener( sink, bundle, aggregate );

      report.addListener( reportSink );
      ruleContext.setReport( report );
      reportSink.beginDocument();
      report.start();

      for ( final IFlexFile file : pmd.getViolations().keySet() )
      {
         final File javaFile = new File( file.getFilePath() ); // NOPMD
         final List< IFlexViolation > violations = pmd.getViolations().get( file );

         reportSink.beginFile( javaFile,
                               new PmdFileInfo( project, javaFile.getParentFile(), "" ) ); // NOPMD
         ruleContext.setSourceCodeFilename( file.getPackageName()
               + "." + file.getClassName() );

         for ( final IFlexViolation violation : violations )
         {
            report.addRuleViolation( violation );
            reportSink.ruleViolationAdded( violation );
         }
         reportSink.endFile( javaFile );
      }

      reportSink.endDocument();
      report.end();

      return report;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.