Documentation ¶
Index ¶
- func CategoryID(rule Rule) string
- func LintID(rule Rule) string
- type FinalizingRule
- type MultiContextEvaluator
- type MultiContextFullEvaluator
- type MultiContextPerNodeEvaluator
- type MultiContextRule
- func (m *MultiContextRule) Evaluate(node *parser.Node, validationContext ValidationContext) *ValidationResult
- func (m *MultiContextRule) Finalize() *ValidationResult
- func (m *MultiContextRule) GetCategory() *string
- func (m *MultiContextRule) GetCommands() []commands.DockerCommand
- func (m *MultiContextRule) GetContexts() *[]ValidationContext
- func (m *MultiContextRule) GetDetails() string
- func (m *MultiContextRule) GetLintID() string
- func (m *MultiContextRule) GetName() string
- func (m *MultiContextRule) GetPriority() model.Priority
- func (m *MultiContextRule) GetSummary() string
- func (m *MultiContextRule) GetURL() *string
- func (m *MultiContextRule) Reset()
- type NodeValidationContext
- type ResettingRule
- type Rule
- type SimpleDeferredRegexRule
- func (r *SimpleDeferredRegexRule) Evaluate(node *parser.Node, validationContext ValidationContext) *ValidationResult
- func (r *SimpleDeferredRegexRule) Finalize() *ValidationResult
- func (r *SimpleDeferredRegexRule) GetCategory() *string
- func (r *SimpleDeferredRegexRule) GetCommands() []commands.DockerCommand
- func (r *SimpleDeferredRegexRule) GetDetails() string
- func (r *SimpleDeferredRegexRule) GetLintID() string
- func (r *SimpleDeferredRegexRule) GetName() string
- func (r *SimpleDeferredRegexRule) GetPriority() model.Priority
- func (r *SimpleDeferredRegexRule) GetSummary() string
- func (r *SimpleDeferredRegexRule) GetURL() *string
- func (r *SimpleDeferredRegexRule) Reset()
- type SimpleRegexRule
- func (r SimpleRegexRule) Evaluate(node *parser.Node, validationContext ValidationContext) *ValidationResult
- func (r SimpleRegexRule) GetCategory() *string
- func (r SimpleRegexRule) GetCommands() []commands.DockerCommand
- func (r SimpleRegexRule) GetDetails() string
- func (r SimpleRegexRule) GetLintID() string
- func (r SimpleRegexRule) GetName() string
- func (r SimpleRegexRule) GetPriority() model.Priority
- func (r SimpleRegexRule) GetSummary() string
- func (r SimpleRegexRule) GetURL() *string
- type SimpleRule
- func (r SimpleRule) Evaluate(node *parser.Node, validationContext ValidationContext) *ValidationResult
- func (r SimpleRule) GetCategory() *string
- func (r SimpleRule) GetCommands() []commands.DockerCommand
- func (r SimpleRule) GetDetails() string
- func (r SimpleRule) GetLintID() string
- func (r SimpleRule) GetName() string
- func (r SimpleRule) GetPriority() model.Priority
- func (r SimpleRule) GetSummary() string
- func (r SimpleRule) GetURL() *string
- type Validation
- type ValidationContext
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CategoryID ¶
CategoryID determines an identifier in relation to the rule
Types ¶
type FinalizingRule ¶
type FinalizingRule interface { ResettingRule // Finalize the validation evaluation Finalize() *ValidationResult }
FinalizingRule defines the behaviors for a rule which performs optional post-processing or finalization before returning a ValidationResult
type MultiContextEvaluator ¶ added in v0.3.0
type MultiContextEvaluator interface { // Evaluate a given MultiContextRule to determine the final ValidationResult Evaluate(mcr *MultiContextRule) *ValidationResult }
MultiContextEvaluator defines the Evaluate interface used by MultiContextRule in the Finalize step
type MultiContextFullEvaluator ¶ added in v0.3.0
type MultiContextFullEvaluator struct { // Fn evaluates a given MultiContextRule to determine the final ValidationResult Fn func(mcr *MultiContextRule) *ValidationResult }
MultiContextFullEvaluator evaluates the MultiContextRule contextually, where the handler function has access to the entire NodeValidationContext cache
func (MultiContextFullEvaluator) Evaluate ¶ added in v0.3.0
func (m MultiContextFullEvaluator) Evaluate(mcr *MultiContextRule) *ValidationResult
Evaluate a given MultiContextRule to determine the final ValidationResult
type MultiContextPerNodeEvaluator ¶ added in v0.3.0
type MultiContextPerNodeEvaluator struct { // Fn evaluates a parser.Node and its associated ValidationContext to determine if the context is valid Fn func(node *parser.Node, validationContext ValidationContext) model.Valid }
MultiContextPerNodeEvaluator evaluates each node entry against the Handler Fn
func (MultiContextPerNodeEvaluator) Evaluate ¶ added in v0.3.0
func (m MultiContextPerNodeEvaluator) Evaluate(mcr *MultiContextRule) *ValidationResult
Evaluate a given MultiContextRule to determine the final ValidationResult
type MultiContextRule ¶
type MultiContextRule struct { Name string `json:"name,omitempty"` Summary string `json:"summary,omitempty"` Details string `json:"details,omitempty"` Priority model.Priority `json:"priority,omitempty"` Commands []commands.DockerCommand `json:"commands,omitempty"` AppliesToBuilder bool `json:"applies_to_builder,omitempty"` Category *string `json:"category,omitempty"` URL *string `json:"url,omitempty"` Evaluator MultiContextEvaluator `json:"-"` ContextCache *[]NodeValidationContext `json:"-"` // contains filtered or unexported fields }
MultiContextRule is a rule which spans the context of one or more lines, suggesting a need for deferred evaluation of that rule.
func (*MultiContextRule) Evaluate ¶
func (m *MultiContextRule) Evaluate(node *parser.Node, validationContext ValidationContext) *ValidationResult
Evaluate a parsed node and its context
func (*MultiContextRule) Finalize ¶
func (m *MultiContextRule) Finalize() *ValidationResult
Finalize the validation evaluation
func (*MultiContextRule) GetCategory ¶
func (m *MultiContextRule) GetCategory() *string
GetCategory gets the category of the rule
func (*MultiContextRule) GetCommands ¶
func (m *MultiContextRule) GetCommands() []commands.DockerCommand
GetCommands gets the commands of the rule
func (*MultiContextRule) GetContexts ¶ added in v0.3.2
func (m *MultiContextRule) GetContexts() *[]ValidationContext
GetContexts returns a pointer to the ValidationContext slice copy
func (*MultiContextRule) GetDetails ¶
func (m *MultiContextRule) GetDetails() string
GetDetails gets the details of the rule
func (*MultiContextRule) GetLintID ¶
func (m *MultiContextRule) GetLintID() string
GetLintID gets the lint ID of the rule
func (*MultiContextRule) GetName ¶
func (m *MultiContextRule) GetName() string
GetName gets the name of the rule
func (*MultiContextRule) GetPriority ¶
func (m *MultiContextRule) GetPriority() model.Priority
GetPriority gets the priority of the rule
func (*MultiContextRule) GetSummary ¶
func (m *MultiContextRule) GetSummary() string
GetSummary gets the summary of the rule
func (*MultiContextRule) GetURL ¶
func (m *MultiContextRule) GetURL() *string
GetURL gets the URL of the rule
type NodeValidationContext ¶
type NodeValidationContext struct { Node parser.Node Context ValidationContext }
NodeValidationContext associates a parser.Node and ValidationContext, such as deferred execution via rules implementing FinalizingRule.
type ResettingRule ¶
type ResettingRule interface { Rule // Reset the rule's internal state Reset() }
ResettingRule defines the behaviors for a rule which can have its state externally reset. It is up to values implementing this interface to appropriately lock resources as needed.
type Rule ¶
type Rule interface { // GetName gets the name of the rule GetName() string // GetSummary gets the summary of the rule GetSummary() string // GetDetails gets the details of the rule GetDetails() string // GetPriority gets the priority of the rule GetPriority() model.Priority // GetCommands gets the commands of the rule GetCommands() []commands.DockerCommand // GetCategory gets the category of the rule GetCategory() *string // GetURL gets the URL of the rule GetURL() *string // GetLintID gets the lint ID of the rule GetLintID() string // Evaluate a parsed node and its context Evaluate(node *parser.Node, validationContext ValidationContext) *ValidationResult }
Rule defines the immutable interface and behaviors for those types implementing evaluations and their details
type SimpleDeferredRegexRule ¶
type SimpleDeferredRegexRule struct { Name string `json:"name,omitempty"` Summary string `json:"summary,omitempty"` Details string `json:"details,omitempty"` Patterns []string `json:"patterns,omitempty"` Priority model.Priority `json:"priority,omitempty"` Commands []commands.DockerCommand `json:"commands,omitempty"` AppliesToBuilder bool `json:"applies_to_builder,omitempty"` Category *string `json:"category,omitempty"` URL *string `json:"url,omitempty"` // contains filtered or unexported fields }
SimpleDeferredRegexRule is a no-frills regex evaluation which occurs after all relevant nodes of the Dockerfile are parsed and evaluated.
func (*SimpleDeferredRegexRule) Evaluate ¶
func (r *SimpleDeferredRegexRule) Evaluate(node *parser.Node, validationContext ValidationContext) *ValidationResult
Evaluate a parsed node and its context
func (*SimpleDeferredRegexRule) Finalize ¶
func (r *SimpleDeferredRegexRule) Finalize() *ValidationResult
Finalize the validation evaluation
func (*SimpleDeferredRegexRule) GetCategory ¶
func (r *SimpleDeferredRegexRule) GetCategory() *string
GetCategory gets the category of the rule
func (*SimpleDeferredRegexRule) GetCommands ¶
func (r *SimpleDeferredRegexRule) GetCommands() []commands.DockerCommand
GetCommands gets the commands of the rule
func (*SimpleDeferredRegexRule) GetDetails ¶
func (r *SimpleDeferredRegexRule) GetDetails() string
GetDetails gets the details of the rule
func (*SimpleDeferredRegexRule) GetLintID ¶
func (r *SimpleDeferredRegexRule) GetLintID() string
GetLintID gets the lint ID of the rule
func (*SimpleDeferredRegexRule) GetName ¶
func (r *SimpleDeferredRegexRule) GetName() string
GetName gets the name of the rule
func (*SimpleDeferredRegexRule) GetPriority ¶
func (r *SimpleDeferredRegexRule) GetPriority() model.Priority
GetPriority gets the priority of the rule
func (*SimpleDeferredRegexRule) GetSummary ¶
func (r *SimpleDeferredRegexRule) GetSummary() string
GetSummary gets the summary of the rule
func (*SimpleDeferredRegexRule) GetURL ¶
func (r *SimpleDeferredRegexRule) GetURL() *string
GetURL gets the URL of the rule
func (*SimpleDeferredRegexRule) Reset ¶
func (r *SimpleDeferredRegexRule) Reset()
Reset the rule's internal state
type SimpleRegexRule ¶
type SimpleRegexRule struct { Name string `json:"name,omitempty"` Summary string `json:"summary,omitempty"` Details string `json:"details,omitempty"` Pattern string `json:"pattern,omitempty"` Priority model.Priority `json:"priority,omitempty"` Command commands.DockerCommand `json:"command,omitempty"` Category *string `json:"category,omitempty"` URL *string `json:"url,omitempty"` // contains filtered or unexported fields }
SimpleRegexRule is a no-frills regex evaluation which occurs for each relevant docker node.
func (SimpleRegexRule) Evaluate ¶
func (r SimpleRegexRule) Evaluate(node *parser.Node, validationContext ValidationContext) *ValidationResult
Evaluate a parsed node and its context
func (SimpleRegexRule) GetCategory ¶
func (r SimpleRegexRule) GetCategory() *string
GetCategory gets the category of the rule
func (SimpleRegexRule) GetCommands ¶
func (r SimpleRegexRule) GetCommands() []commands.DockerCommand
GetCommands gets the commands of the rule
func (SimpleRegexRule) GetDetails ¶
func (r SimpleRegexRule) GetDetails() string
GetDetails gets the details of the rule
func (SimpleRegexRule) GetLintID ¶
func (r SimpleRegexRule) GetLintID() string
GetLintID gets the lint ID of the rule
func (SimpleRegexRule) GetName ¶
func (r SimpleRegexRule) GetName() string
GetName gets the name of the rule
func (SimpleRegexRule) GetPriority ¶
func (r SimpleRegexRule) GetPriority() model.Priority
GetPriority gets the priority of the rule
func (SimpleRegexRule) GetSummary ¶
func (r SimpleRegexRule) GetSummary() string
GetSummary gets the summary of the rule
func (SimpleRegexRule) GetURL ¶
func (r SimpleRegexRule) GetURL() *string
GetURL gets the URL of the rule
type SimpleRule ¶
type SimpleRule struct { Name string `json:"name,omitempty"` Summary string `json:"summary,omitempty"` Details string `json:"details,omitempty"` Priority model.Priority `json:"priority,omitempty"` Commands []commands.DockerCommand `json:"commands,omitempty"` Handler handlerFunc `json:"-"` Category *string `json:"category,omitempty"` URL *string `json:"url,omitempty"` }
SimpleRule is the simplest implementation of a rule
func (SimpleRule) Evaluate ¶
func (r SimpleRule) Evaluate(node *parser.Node, validationContext ValidationContext) *ValidationResult
Evaluate a parsed node and its context
func (SimpleRule) GetCategory ¶
func (r SimpleRule) GetCategory() *string
GetCategory gets the category of the rule
func (SimpleRule) GetCommands ¶
func (r SimpleRule) GetCommands() []commands.DockerCommand
GetCommands gets the commands of the rule
func (SimpleRule) GetDetails ¶
func (r SimpleRule) GetDetails() string
GetDetails gets the details of the rule
func (SimpleRule) GetLintID ¶
func (r SimpleRule) GetLintID() string
GetLintID gets the lint ID of the rule
func (SimpleRule) GetPriority ¶
func (r SimpleRule) GetPriority() model.Priority
GetPriority gets the priority of the rule
func (SimpleRule) GetSummary ¶
func (r SimpleRule) GetSummary() string
GetSummary gets the summary of the rule
type Validation ¶
type Validation struct { ID string `json:"id,omitempty"` // The ID of the rule Path string `json:"path,omitempty"` // The Path of the Dockerfile Rule *Rule `json:"rule,omitempty"` // The Rule applied ValidationResult `json:"validation_result"` // A Validation is composed of ValidationResult }
Validation represents the result of evaluating the Rule against the Dockerfile located at Path
type ValidationContext ¶
type ValidationContext struct { Line string `json:"line,omitempty"` // The Line of text being evaluated, as parsed from the Dockerfile Locations []docker.Location `json:"locations,omitempty"` // The start and end Locations within the Dockerfile CausedFailure bool `json:"caused_failure,omitempty"` // Whether the parsed Line caused a failure in the final Validation HasRecommendations bool `json:"has_recommendations,omitempty"` // Whether the parsed Line includes a recommendation in the final Validation IsBuilderContext bool `json:"is_builder_context,omitempty"` // Whether the context is a "builder" context of a multi-stage build }
ValidationContext details whether a line and positions within that line caused a validation failure
type ValidationResult ¶
type ValidationResult struct { Result model.Valid `json:"result,omitempty"` Details string `json:"details,omitempty"` Contexts []ValidationContext `json:"contexts,omitempty"` }
ValidationResult is the primitive defaulting the result, details, and contextual information about a rule evaluation
func NewValidationResultIgnored ¶
func NewValidationResultIgnored(details string) *ValidationResult
NewValidationResultIgnored is a utility function to create a result which is model.Ignored
func NewValidationResultSkipped ¶
func NewValidationResultSkipped(details string) *ValidationResult
NewValidationResultSkipped is a utility function to create a result which is model.Skipped
func (ValidationResult) GoString ¶ added in v0.2.0
func (v ValidationResult) GoString() string
GoString returns a string representation for formatter patterns %#v