mirror of
https://github.com/anchore/syft.git
synced 2025-11-19 09:23:15 +01:00
* add policy for empty name and version Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * default stub version Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * modifying ids requires augmenting relationships Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package options
|
|
|
|
import (
|
|
"github.com/anchore/fangs"
|
|
"github.com/anchore/syft/syft/cataloging"
|
|
)
|
|
|
|
var (
|
|
_ fangs.FieldDescriber = (*complianceConfig)(nil)
|
|
_ fangs.PostLoader = (*complianceConfig)(nil)
|
|
)
|
|
|
|
type complianceConfig struct {
|
|
MissingName cataloging.ComplianceAction `mapstructure:"missing-name" json:"missing-name" yaml:"missing-name"`
|
|
MissingVersion cataloging.ComplianceAction `mapstructure:"missing-version" json:"missing-version" yaml:"missing-version"`
|
|
}
|
|
|
|
func defaultComplianceConfig() complianceConfig {
|
|
def := cataloging.DefaultComplianceConfig()
|
|
return complianceConfig{
|
|
MissingName: def.MissingName,
|
|
MissingVersion: def.MissingVersion,
|
|
}
|
|
}
|
|
|
|
func (r *complianceConfig) DescribeFields(descriptions fangs.FieldDescriptionSet) {
|
|
descriptions.Add(&r.MissingName, "action to take when a package is missing a name")
|
|
descriptions.Add(&r.MissingVersion, "action to take when a package is missing a version")
|
|
}
|
|
|
|
func (r *complianceConfig) PostLoad() error {
|
|
r.MissingName = r.MissingName.Parse()
|
|
r.MissingVersion = r.MissingVersion.Parse()
|
|
return nil
|
|
}
|