Documentation
¶
Index ¶
- func CollectFiles(paths []string, recursive bool) ([]string, error)
- func FormatJSON(w io.Writer, output *Output) error
- func FormatOutput(w io.Writer, output *Output, format string) error
- func FormatPlain(w io.Writer, output *Output) error
- func FormatYAML(w io.Writer, output *Output) error
- func ReadFromStdin(r io.Reader) ([]byte, error)
- type Output
- func Bytes(fileBytes []byte, ruleSet *rulesets.RuleSet, failSeverity string, ...) *Output
- func Content(content []byte, ruleSetBytes []byte, failSeverity string, onlyFailures bool, ...) (*Output, error)
- func File(filePath string, ruleSetBytes []byte, failSeverity string, onlyFailures bool) (*Output, error)
- func Files(filePaths []string, ruleSetBytes []byte, failSeverity string, ...) (*Output, error)
- type Result
- type Severity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectFiles ¶
CollectFiles resolves file paths from the provided sources. If a path is a directory, it collects all YAML/YML files within it. When recursive is true, it walks subdirectories as well.
func FormatJSON ¶
FormatJSON writes the linting output in JSON format to the writer.
func FormatOutput ¶
FormatOutput writes linting output in the specified format.
func FormatPlain ¶
FormatPlain writes the linting output in plain text format to the writer.
func FormatYAML ¶
FormatYAML writes the linting output in YAML format to the writer.
Types ¶
type Output ¶
type Output struct {
TotalCount int `json:"total_count" yaml:"total_count"`
FailCount int `json:"fail_count" yaml:"fail_count"`
Results []Result `json:"results" yaml:"results"`
}
Output contains the aggregated linting results across all files.
func Bytes ¶
func Bytes( fileBytes []byte, ruleSet *rulesets.RuleSet, failSeverity string, onlyFailures bool, fileName string, ) *Output
Bytes lints raw file bytes against a pre-parsed ruleset.
func Content ¶
func Content( content []byte, ruleSetBytes []byte, failSeverity string, onlyFailures bool, sourceName string, ) (*Output, error)
Content lints raw content bytes against a ruleset provided as bytes. This is useful for linting stdin or other non-file sources.
type Result ¶
type Result struct {
Message string `json:"message" yaml:"message"`
Path string `json:"path" yaml:"path"`
Severity string `json:"severity" yaml:"severity"`
RuleID string `json:"rule_id" yaml:"rule_id"`
Line int `json:"line" yaml:"line"`
Column int `json:"column" yaml:"column"`
File string `json:"file,omitempty" yaml:"file,omitempty"`
}
Result represents a single linting violation found in a file.
type Severity ¶
type Severity int
Severity represents the severity level of a linting violation.
func ParseSeverity ¶
ParseSeverity converts a severity string to its Severity enum value. Returns SeverityWarn for unrecognized or empty strings, which is a conservative middle-ground: results without a severity are treated as warnings rather than being silently ignored or incorrectly elevated.