Class ScanResultFactory


  • public final class ScanResultFactory
    extends Object
    A factory for creating instances of ScanResult
    Author:
    Brian Wyka
    • Method Detail

      • enforcerResult

        public static ScanResult enforcerResult​(ExecOptions execOptions,
                                                String repositoryPath,
                                                Severity severity,
                                                com.optum.sourcehawk.enforcer.EnforcerResult enforcerResult)
        Create a scan result based on the file protocol and enforcer result
        Parameters:
        execOptions - the exec options
        repositoryPath - the path to the file in the repository
        severity - the severity of the file protocol
        enforcerResult - the result of the enforcer
        Returns:
        the derived scan result
      • error

        public static ScanResult error​(String repositoryPath,
                                       String message)
        Create the scan result for situations where there is an error executing the scan
        Parameters:
        repositoryPath - the path to the file in the repository
        message - the error message
        Returns:
        the scan result
      • globalError

        public static ScanResult globalError​(Throwable throwable)
        Create the scan result for situations where there is an exception executing the scan
        Parameters:
        throwable - the exception / error which occurred
        Returns:
        the scan result
      • fileNotFound

        public static ScanResult fileNotFound​(ExecOptions execOptions,
                                              FileProtocol fileProtocol)
        Generate a scan result for situations where the file is not found
        Parameters:
        execOptions - the exec options
        fileProtocol - the file protocol
        Returns:
        the file not found scan result
      • fileNotFound

        public static ScanResult fileNotFound​(ExecOptions execOptions,
                                              String repositoryPath,
                                              String fileProtocolSeverity)
        Generate a scan result for situations where the file is not found
        Parameters:
        execOptions - the exec options
        repositoryPath - the repository path
        fileProtocolSeverity - the file protocol severity
        Returns:
        the file not found scan result