Skip to content

Commit

Permalink
fix #422, allow consumer templating to also carry information about w…
Browse files Browse the repository at this point in the history
…hich annotation contains the code fix
  • Loading branch information
northdpole committed Oct 15, 2024
1 parent 10cb877 commit 929199b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions pkg/templating/template_description.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ func TemplateStringRaw(inputTemplate string, issue *v1.Issue) (*string, error) {

type enrichedIssue struct {
*v1.EnrichedIssue
ToolName string
ScanStartTime string
ScanID string
ConfidenceText string
SeverityText string
Count uint
FirstFound string
ToolName string
ScanStartTime string
ScanID string
ConfidenceText string
SeverityText string
Count uint
FirstFound string
FixedCodeAnnotation string
}
type enrichedIssueOption func(*enrichedIssue) error

Expand Down Expand Up @@ -118,6 +119,13 @@ func EnrichedIssueWithFirstFound(firstFound time.Time) enrichedIssueOption {
}
}

func EnrichedIssueWithFixedCodeAnnotation(fixedCodeAnnotation string) enrichedIssueOption {
return func(ei *enrichedIssue) error {
ei.FixedCodeAnnotation = fixedCodeAnnotation
return nil
}
}

// TemplateStringEnriched applies the provided go template to the Enriched Issue provided and returns the resulting str
func TemplateStringEnriched(inputTemplate string, issue *v1.EnrichedIssue, opts ...enrichedIssueOption) (*string, error) {
enrichedIssue := &enrichedIssue{
Expand Down

0 comments on commit 929199b

Please sign in to comment.