Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetRegexEngine ¶
func SetRegexEngine(e RegexEngine)
SetRegexEngine globally applies the preferred regex library to use
func StringSliceContains ¶ added in v0.3.2
StringSliceContains determines if str exists in slice
Types ¶
type Pattern ¶
Pattern defines the limited string matching interface to perform against a regex pattern
func NewPattern ¶
NewPattern creates a new Pattern value from the provided value Note that this makes no assertions of the value, and go 'regexp' supports a subset of regex syntax. Use SetRegexEngine to change the underlying regex library if necessary.
type PredicateMap ¶ added in v0.3.2
PredicateMap is a map of boolean valued functions with single string inputs. These can be used to represent "lookups" of allowed values.
func (PredicateMap) Keys ¶ added in v0.3.2
func (a PredicateMap) Keys() []string
Keys returns a new slice of the PredicateMap keys
type Priority ¶
type Priority int
Priority represents an enum of supported priorities. Priorities are more or less self-explanatory:
- LowPriority
- MediumPriority
- HighPriority
- CriticalPriority
const ( // LowPriority indicates less important rules, such as recommendations. LowPriority Priority = iota // MediumPriority indicates a rule which should be handled eventually, or which may be irrelevant based on // the base image or other factors which can't be evaluated statically. This can often be considered a "notice" // or cleanup task item. MediumPriority // HighPriority indicates a rule which raises non-security concerns. // Deployments with failed HighPriority rules can be done with good reason. HighPriority // CriticalPriority indicates a rule which raises a potential security or "correctness" conern which should be fixed // before deploying an image based on the current Dockerfile. Deploying an image with CriticalPriority issues could // result in production bugs or breaking consumers of the image. CriticalPriority )
func (*Priority) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.v3 interface for unmarshalling YAML
type RegexEngine ¶
type RegexEngine int
RegexEngine provides an enum type of supported engines
const ( // RegexpEngine is the go standard library RegEx engine RegexpEngine RegexEngine = iota // Regexp2Engine is the regexp2 engine, which is a port of the .NET Core RegEx engine (or, full RegEx support) Regexp2Engine )
type StandardPattern ¶
type StandardPattern struct {
// contains filtered or unexported fields
}
StandardPattern is the default implementation abstracting over a pattern for use with the configurable regex engine. Use SetRegexEngine to change the underlying regex library if necessary.
func (StandardPattern) Matches ¶
func (s StandardPattern) Matches(value string) bool
Matches dispatches string matching to the configured regex engine
type Valid ¶
type Valid int
Valid is represents an enum of valid states for a validations.ValidationResult State names and uses are self-explanatory:
- Success
- Failure
- Ignored
- Skipped
- Recommendation
const ( // Success is when validation results in a non-failure state. // This does not imply the validation was relevant to the line(s) evaluated, which is up to the rule. Success Valid = iota // Failure is when validation was not successful. Failure // Ignored is when a rule is not evaluated because it was specifically ignored by the user. Ignored // Skipped is when a rule is not evaluated, but was not skipped by the user (in which case it will be Ignored). // A Skipped state may occur when a rule is only contextually relevant, such as being irrelevant in builder contexts. Skipped // Recommendation is a completed validation that is neither success/failure but more of a best practice. // A result returning Recommendation should not cause any failures on execution. These represent situations which are // generally not a good idea (e.g. ADD http://example.com/root.tgz) but have valid use cases (e.g. scratch images). Recommendation )