Documentation ¶
Index ¶
- func UniqueProbesEqual(findings []Finding, probes []string) bool
- type AnonymousFinding
- type FileType
- type Finding
- func FromBytes(content []byte, probeID string) (*Finding, error)
- func New(loc embed.FS, probeID string) (*Finding, error)
- func NewNegative(efs embed.FS, probeID, text string, loc *Location) (*Finding, error)
- func NewNotAvailable(efs embed.FS, probeID, text string, loc *Location) (*Finding, error)
- func NewPositive(efs embed.FS, probeID, text string, loc *Location) (*Finding, error)
- func NewWith(efs embed.FS, probeID, text string, loc *Location, o Outcome) (*Finding, error)
- func (f *Finding) Anonymize() *AnonymousFinding
- func (f *Finding) WithLocation(loc *Location) *Finding
- func (f *Finding) WithMessage(text string) *Finding
- func (f *Finding) WithOutcome(o Outcome) *Finding
- func (f *Finding) WithPatch(patch *string) *Finding
- func (f *Finding) WithRemediationMetadata(values map[string]string) *Finding
- type Location
- type Outcome
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UniqueProbesEqual ¶ added in v4.12.0
UniqueProbesEqual checks the probe names present in a list of findings and compare them against an expected list.
Types ¶
type AnonymousFinding ¶ added in v4.11.0
type AnonymousFinding struct { Finding // Remove the probe ID from // the structure until the probes are GA. Probe string `json:"probe,omitempty"` }
AnonymousFinding is a finding without a corerpsonding probe ID.
type Finding ¶
type Finding struct { Probe string `json:"probe"` Outcome Outcome `json:"outcome"` Message string `json:"message"` Location *Location `json:"location,omitempty"` Remediation *probe.Remediation `json:"remediation,omitempty"` }
Finding represents a finding. nolint: govet
func FromBytes ¶ added in v4.11.0
FromBytes creates a finding for a probe given its config file's content.
func NewNegative ¶ added in v4.11.0
NewWith create a negative finding with the desired location.
func NewNotAvailable ¶ added in v4.11.0
NewNotAvailable create a finding with a NotAvailable outcome and the desired location.
func NewPositive ¶ added in v4.11.0
NewPositive create a positive finding with the desired location.
func (*Finding) Anonymize ¶ added in v4.11.0
func (f *Finding) Anonymize() *AnonymousFinding
Anonymize removes the probe ID and outcome from the finding. It is a temporary solution to integrate the code in the details without exposing too much information.
func (*Finding) WithLocation ¶
WithLocation adds a location to an existing finding. No copy is made.
func (*Finding) WithMessage ¶
WithMessage adds a message to an existing finding. No copy is made.
func (*Finding) WithOutcome ¶
WithOutcome adds an outcome to an existing finding. No copy is made. WARNING: this function should be called at most once for a finding.
type Location ¶
type Location struct { Type FileType `json:"type"` Path string `json:"path"` LineStart *uint `json:"lineStart,omitempty"` LineEnd *uint `json:"lineEnd,omitempty"` Snippet *string `json:"snippet,omitempty"` }
Location represents the location of a finding. nolint: govet
type Outcome ¶
type Outcome int
Outcome is the result of a finding.
const ( // NOTE: The additional '_' are intended for future use. // This allows adding outcomes without breaking the values // of existing outcomes. // OutcomeNegative indicates a negative outcome. OutcomeNegative Outcome = iota // OutcomeNotAvailable indicates an unavailable outcome, // typically because an API call did not return an answer. OutcomeNotAvailable // OutcomeError indicates an errors while running. // The results could not be determined. OutcomeError // OutcomePositive indicates a positive outcome. OutcomePositive // OutcomeNotSupported indicates a non-supported outcome. OutcomeNotSupported )
TODO(#2928): re-visit the finding definitions.
func (*Outcome) UnmarshalYAML ¶ added in v4.11.0
UnmarshalYAML is a custom unmarshalling function to transform the string into an enum.