Class ReportTool


  • public class ReportTool
    extends java.lang.Object
    Utilities to format items in the Velocity reports.
    Author:
    Jeremy Long
    • Constructor Summary

      Constructors 
      Constructor Description
      ReportTool()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<SarifRule> convertToSarifRules​(java.util.List<Dependency> dependencies)
      Creates a list of SARIF rules for the SARIF report.
      java.lang.Double estimateSeverity​(java.lang.String severity)
      Estimates the CVSS V2 score for the given severity.
      java.lang.String identifierToSuppressionId​(Identifier id)
      Converts an identifier into the Suppression string when possible.
      java.lang.String normalizeSeverity​(java.lang.String sev)
      Map severity names from various sources to a standard set of severity names.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReportTool

        public ReportTool()
    • Method Detail

      • identifierToSuppressionId

        public java.lang.String identifierToSuppressionId​(Identifier id)
        Converts an identifier into the Suppression string when possible.
        Parameters:
        id - the Identifier to format
        Returns:
        the formatted suppression string when possible; otherwise null.
      • estimateSeverity

        public java.lang.Double estimateSeverity​(java.lang.String severity)
        Estimates the CVSS V2 score for the given severity.
        Parameters:
        severity - the text representation of a score
        Returns:
        the estimated score
      • convertToSarifRules

        public java.util.Collection<SarifRule> convertToSarifRules​(java.util.List<Dependency> dependencies)
        Creates a list of SARIF rules for the SARIF report.
        Parameters:
        dependencies - the list of dependencies to extract rules from
        Returns:
        the list of SARIF rules
      • normalizeSeverity

        public java.lang.String normalizeSeverity​(java.lang.String sev)
        Map severity names from various sources to a standard set of severity names.
        Parameters:
        sev - the severity name
        Returns:
        the standardized severity name (critical, high, medium, low, unknown)