Documentation
¶
Overview ¶
Package readers implements the various supported package manifest reader. It defines an independent contract for implementing and reading packages from one or more package manifest files. For more details, refer TDD
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PackageManifestReader ¶
type PackageManifestReader interface {
Name() string
EnumManifests(func(*models.PackageManifest, PackageReader) error) error
}
Contract for implementing package manifest readers such as lockfile parser, SBOM parser etc. Reader should stop enumeration and return error if handler returns an error
func NewDirectoryReader ¶ added in v1.0.0
func NewDirectoryReader(path string, exclusions []string) (PackageManifestReader, error)
NewDirectoryReader creates a PackageManifestReader that can scan a directory for package manifests while honoring exclusion rules. This reader will log and ignore parser failure. But it will fail in case the manifest handler returns an error. Exclusion strings are treated as regex patterns and applied on the absolute file path discovered while talking the directory.
func NewJsonDumpReader ¶ added in v1.0.0
func NewJsonDumpReader(path string) (PackageManifestReader, error)
NewJsonDumpReader creates a PackageManifestReader to read JSON dumps from the given directory path. The JSON files in the directory must be generated with `--json-dump-dir` scan option. This reader will fail on first error while scanning and loading JSON manifests from file
func NewLockfileReader ¶ added in v1.0.0
func NewLockfileReader(lockfiles []string, lockfileAs string) (PackageManifestReader, error)
NewLockfileReader creates a PackageManifestReader that can be used to read one or more `lockfiles` interpreted as `lockfileAs`. When `lockfileAs` is empty the parser auto-detects the format based on file name. This reader fails and returns an error on first error encountered while parsing lockfiles
type PackageReader ¶
Contract for implementing a package reader. Enumerator should fail and return error if handler fails
func NewManifestModelReader ¶
func NewManifestModelReader(manifest *models.PackageManifest) PackageReader
NewManifestModelReader creates a PackageReader for a manifest model that enforces global exceptions policy to ignore packages based on policy It returns a PackageReader that can be used to enumerate all packages in the given manifest.