analyzer

package
v0.0.0-...-da6a0aa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrUnknownOS occurs when unknown OS is analyzed.
	ErrUnknownOS = xerrors.New("unknown OS")
	// ErrPkgAnalysis occurs when the analysis of packages is failed.
	ErrPkgAnalysis = xerrors.New("failed to analyze packages")
	// ErrNoPkgsDetected occurs when the required files for an OS package manager are not detected
	ErrNoPkgsDetected = xerrors.New("no packages detected")
)

Functions

func CheckPackage

func CheckPackage(pkg *types.Package) bool

func RegisterAnalyzer

func RegisterAnalyzer(analyzer analyzer)

func RegisterConfigAnalyzer

func RegisterConfigAnalyzer(analyzer configAnalyzer)

Types

type AnalysisResult

type AnalysisResult struct {
	OS           *types.OS
	PackageInfos []types.PackageInfo
	Applications []types.Application
	Configs      []types.Config
	// contains filtered or unexported fields
}

func (*AnalysisResult) Merge

func (r *AnalysisResult) Merge(new *AnalysisResult)

func (*AnalysisResult) Sort

func (r *AnalysisResult) Sort()

type AnalysisTarget

type AnalysisTarget struct {
	FilePath string
	Content  []byte
}

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

func NewAnalyzer

func NewAnalyzer(disabledAnalyzers []Type) Analyzer

func (Analyzer) AnalyzeFile

func (a Analyzer) AnalyzeFile(wg *sync.WaitGroup, result *AnalysisResult, filePath string, info os.FileInfo,
	opener Opener) error

func (Analyzer) AnalyzeImageConfig

func (a Analyzer) AnalyzeImageConfig(targetOS types.OS, configBlob []byte) []types.Package

func (Analyzer) AnalyzerVersions

func (a Analyzer) AnalyzerVersions() string

AnalyzerVersions returns analyzer version identifier used for cache suffixes. e.g. alpine: 1, amazon: 3, debian: 2 => 132 When the amazon analyzer is disabled => 102

func (Analyzer) ImageConfigAnalyzerVersions

func (a Analyzer) ImageConfigAnalyzerVersions() string

ImageConfigAnalyzerVersions returns analyzer version identifier used for cache suffixes.

type Opener

type Opener func() ([]byte, error)

type Type

type Type int
const (
	// OS
	TypeAlpine Type = iota + 1
	TypeAmazon
	TypeDebian
	TypePhoton
	TypeCentOS
	TypeFedora
	TypeOracle
	TypeRedHatBase
	TypeSUSE
	TypeUbuntu

	// OS Package
	TypeApk
	TypeDpkg
	TypeRpm

	// Programming Language Package
	TypeBundler
	TypeCargo
	TypeComposer
	TypeJar
	TypeNpm
	TypeNuget
	TypePipenv
	TypePoetry
	TypeYarn

	// Image Config
	TypeApkCommand

	// Structured Config
	TypeYaml
	TypeTOML
	TypeJSON
	TypeDockerfile
	TypeHCL
)

NOTE: Do not change the order of "Type" unnecessarily, as it will affect the cache.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL