Documentation
¶
Overview ¶
Package format implements the output formats decolint can write lint issues in: one-line-per-issue text, a JSON array, GitHub Actions workflow command annotations, and a SARIF 2.1.0 log.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHubFormat ¶
type GitHubFormat struct{}
GitHubFormat prints one GitHub Actions workflow command (::error/::warning) per issue.
func (GitHubFormat) WriteIssues ¶
WriteIssues writes issues to w as GitHub Actions workflow commands. Paths are written with "/" separators, which is what GitHub matches an annotation against.
type JSONFormat ¶
type JSONFormat struct{}
JSONFormat prints a JSON array of issues.
func (JSONFormat) WriteIssues ¶
WriteIssues writes issues to w as a JSON array. It marshals into an in-memory buffer first so that a failure never leaves partial JSON on w.
type SARIFFormat ¶ added in v0.4.0
type SARIFFormat struct {
// Version is the tool version recorded in the run.
Version string
// Rules is the rule catalog used to describe the rules referenced by issues.
Rules []SARIFRule
}
SARIFFormat prints a SARIF 2.1.0 log, suitable for upload to GitHub Code Scanning.
func (SARIFFormat) WriteIssues ¶ added in v0.4.0
WriteIssues writes issues to w as a SARIF 2.1.0 log with a single run. It marshals into an in-memory buffer first so that a failure never leaves partial output on w.
The run's rule catalog lists only the rules referenced by issues, sorted by rule ID; a rule missing from f.Rules is listed with its ID alone. Issue paths are reported as URIs; see [artifactURIFor].
type SARIFRule ¶ added in v0.4.0
SARIFRule describes one rule for the SARIF rule catalog. It mirrors the linter.Rule fields the SARIF output needs, so this package does not depend on the rules package.
type TextFormat ¶
type TextFormat struct{}
TextFormat prints one line per issue, matching linter.Issue.String.
func (TextFormat) WriteIssues ¶
WriteIssues writes issues to w, one line per issue.