presenters

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DedupeByProblemID issueDedupeKey = "problemID"
	DedupeByID        issueDedupeKey = "id"
)
View Source
const ApplicationJSONMimeType = "application/json"
View Source
const ApplicationSarifMimeType = content_type.SARIF_JSON
View Source
const CONFIG_JSON_STRIP_WHITESPACES = "internal_json_no_whitespaces"
View Source
const DefaultMimeType = "text/cli"
View Source
const NoneMimeType = "unknown"

Variables

View Source
var ApplicationSarifTemplates = []string{
	"templates/local_finding.sarif.tmpl",
}
View Source
var ApplicationSarifTemplatesUfm = []string{
	"templates/ufm.sarif.tmpl",
}
View Source
var DefaultTemplateFiles = []string{
	"templates/local_finding.tmpl",
	"templates/finding.component.tmpl",
}

DefaultTemplateFiles is an instance of TemplatePathsStruct with the template paths.

View Source
var DefaultTemplateFilesUfm = []string{
	"templates/ufm.human.tmpl",
}

Functions

func FilterSeverityASC

func FilterSeverityASC(original []string, severityMinLevel string) []string

func HtmlToAnsi

func HtmlToAnsi(tag, cssClass, originalContent string) string

func IsHtml

func IsHtml(str string) bool

func NewJsonWriter

func NewJsonWriter(next io.Writer, stripWhitespaces bool) io.Writer

* This Writer can be used to strip away whitespaces from json content to reduce the final size

func RenderDivider

func RenderDivider() string

func RenderError

func RenderError(err snyk_errors.Error, ctx context.Context) string

func RenderFinding

func RenderFinding(finding Finding) string

func RenderFindings

func RenderFindings(findings []Finding, showIgnored bool, isSeverityThresholdApplied bool) string
func RenderLink(str string) string

func RenderSummary

func RenderSummary(summary *json_schemas.TestSummary, orgName string, testPath string, severityMinLevel string) (string, error)

func RenderTip

func RenderTip(str string) string

func RenderTitle

func RenderTitle(str string) string

Types

type ElementCallback

type ElementCallback func(tagName, cssClass, originalContent string) string

type Finding

type Finding struct {
	ID         string
	Severity   string
	Title      string
	Ignored    bool
	Properties []FindingProperty
}

type FindingProperty

type FindingProperty struct {
	Label string
	Value string
}

type HTMLpresenter

type HTMLpresenter struct {
	Callback ElementCallback
}

func NewHTMLPresenter

func NewHTMLPresenter(callback ElementCallback) *HTMLpresenter

func (*HTMLpresenter) Present

func (p *HTMLpresenter) Present(htmlString string) (string, error)

type JsonWriter

type JsonWriter struct {
	// contains filtered or unexported fields
}

func (*JsonWriter) Write

func (w *JsonWriter) Write(p []byte) (n int, err error)

type LocalFindingPresenter

type LocalFindingPresenter struct {
	TestPath string
	Input    []*local_models.LocalFinding
	// contains filtered or unexported fields
}

func NewLocalFindingsRenderer

func NewLocalFindingsRenderer(localFindingsDoc []*local_models.LocalFinding, config configuration.Configuration, writer io.Writer, options ...LocalFindingPresenterOptions) *LocalFindingPresenter

func (*LocalFindingPresenter) RegisterMimeType

func (p *LocalFindingPresenter) RegisterMimeType(mimeType string, implFactory TemplateImplFunction) error

func (*LocalFindingPresenter) RenderTemplate

func (p *LocalFindingPresenter) RenderTemplate(templateFiles []string, mimeType string) error

type LocalFindingPresenterOptions

type LocalFindingPresenterOptions func(presentation *LocalFindingPresenter)

type SarifPresenter

type SarifPresenter struct {
	ShowIgnored      bool
	Input            sarif.SarifDocument
	OrgName          string
	TestPath         string
	SeverityMinLevel string
}

type SummaryData

type SummaryData struct {
	SummaryTitle                    string
	Org                             string
	TestPath                        string
	Type                            string
	TotalIssueCount                 int
	IgnoreIssueCount                int
	OpenIssueCountWithSeverities    string
	IgnoredIssueCountWithSeverities string
}

func PrepareSummary

func PrepareSummary(summary *json_schemas.TestSummary, orgName string, testPath string, severityMinLevel string) (data SummaryData)

type TemplateImplFunction

type TemplateImplFunction func() (*template.Template, template.FuncMap, error)

type UfmPresenter

type UfmPresenter struct {
	TestPath string
	Input    []testapi.TestResult
	// contains filtered or unexported fields
}

func NewUfmRenderer

func NewUfmRenderer(results []testapi.TestResult, config configuration.Configuration, writer io.Writer, options ...UfmPresenterOptions) *UfmPresenter

func (*UfmPresenter) RegisterMimeType

func (p *UfmPresenter) RegisterMimeType(mimeType string, implFactory TemplateImplFunction) error

func (*UfmPresenter) RenderTemplate

func (p *UfmPresenter) RenderTemplate(templateFiles []string, mimeType string) error

type UfmPresenterOptions

type UfmPresenterOptions func(presentation *UfmPresenter)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL