Class PmdCollectingRenderer

  • All Implemented Interfaces:
    net.sourceforge.pmd.properties.PropertySource, net.sourceforge.pmd.renderers.Renderer

    public class PmdCollectingRenderer
    extends net.sourceforge.pmd.renderers.AbstractRenderer
    A PMD renderer, that collects all violations and processing errors from a pmd execution.
    Author:
    Andreas Dangel
    • Field Summary

      • Fields inherited from class net.sourceforge.pmd.renderers.AbstractRenderer

        description, inputPathPrefixes, name, showSuppressedViolations, writer
      • Fields inherited from class net.sourceforge.pmd.properties.AbstractPropertySource

        propertyDescriptors, propertyValuesByDescriptor
    • Constructor Summary

      Constructors 
      Constructor Description
      PmdCollectingRenderer()
      Collects all reports from all threads.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      net.sourceforge.pmd.Report asReport()
      Create a new single report with all violations for further rendering into other formats than HTML.
      java.lang.String defaultFileExtension()  
      void end()  
      java.util.List<net.sourceforge.pmd.Report.ProcessingError> getErrors()
      Gets all the processing errors.
      java.lang.String getErrorsAsString​(boolean withDetails)
      Gets the errors as a single string.
      java.util.List<net.sourceforge.pmd.RuleViolation> getViolations()
      Gets the list of all found violations.
      boolean hasErrors()
      Checks whether any processing errors have been found.
      boolean hasViolations()
      Checks whether any violations have been found.
      void renderFileReport​(net.sourceforge.pmd.Report report)  
      void start()  
      void startFileAnalysis​(net.sourceforge.pmd.util.datasource.DataSource dataSource)  
      • Methods inherited from class net.sourceforge.pmd.renderers.AbstractRenderer

        determineFileName, flush, getDescription, getName, getPropertySourceType, getWriter, isShowSuppressedViolations, setDescription, setName, setReportFile, setShowSuppressedViolations, setUseShortNames, setWriter
      • Methods inherited from class net.sourceforge.pmd.properties.AbstractPropertySource

        copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, isPropertyOverridden, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface net.sourceforge.pmd.properties.PropertySource

        definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, isPropertyOverridden, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
    • Constructor Detail

      • PmdCollectingRenderer

        public PmdCollectingRenderer()
        Collects all reports from all threads.
    • Method Detail

      • renderFileReport

        public void renderFileReport​(net.sourceforge.pmd.Report report)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • hasViolations

        public boolean hasViolations()
        Checks whether any violations have been found.
        Returns:
        true if at least one violations has been found
      • getViolations

        public java.util.List<net.sourceforge.pmd.RuleViolation> getViolations()
        Gets the list of all found violations.
        Returns:
        the violations
      • hasErrors

        public boolean hasErrors()
        Checks whether any processing errors have been found.
        Returns:
        true if any errors have been found
      • getErrors

        public java.util.List<net.sourceforge.pmd.Report.ProcessingError> getErrors()
        Gets all the processing errors.
        Returns:
        the errors
      • getErrorsAsString

        public java.lang.String getErrorsAsString​(boolean withDetails)
        Gets the errors as a single string. Each error is in its own line.
        Parameters:
        withDetails - if true then add the error details additionally (contains e.g. the stacktrace)
        Returns:
        the errors as string
      • asReport

        public net.sourceforge.pmd.Report asReport()
        Create a new single report with all violations for further rendering into other formats than HTML.
        Returns:
        the report
      • defaultFileExtension

        public java.lang.String defaultFileExtension()
      • start

        public void start()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • startFileAnalysis

        public void startFileAnalysis​(net.sourceforge.pmd.util.datasource.DataSource dataSource)
      • end

        public void end()
                 throws java.io.IOException
        Throws:
        java.io.IOException