finding

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package finding is the one shape every check in lfr reports in: a rule ID, a severity, where, what is wrong and how to fix it. The CLI prints findings the same way whether they come from the server's issue lint or from a newsletter project on disk.

Index

Constants

View Source
const (
	Error   = "error"   // blocks the next step (sending, building)
	Warning = "warning" // lowers quality; fix or justify
	Info    = "info"    // a suggestion
)

Severities, strongest first.

Variables

This section is empty.

Functions

func Blocking

func Blocking(fs []Finding) bool

Blocking reports whether any finding is an error.

func Count

func Count(fs []Finding) (errors, warnings, infos int)

Count returns the number of findings per severity.

func Sort

func Sort(fs []Finding)

Sort orders findings by severity, then file and line.

Types

type Finding

type Finding struct {
	Rule     string `json:"rule"`
	Severity string `json:"severity"`
	File     string `json:"file,omitempty"`
	Line     int    `json:"line,omitempty"`
	Message  string `json:"message"`
	Fix      string `json:"fix"`
}

Finding is one problem.

func (Finding) Where

func (f Finding) Where() string

Where renders file:line, or "" without a file.

type Rule

type Rule struct {
	ID      string `json:"id"`
	Summary string `json:"summary"`
	Help    string `json:"help"`
}

Rule describes a check for `lfr rules`.

Jump to

Keyboard shortcuts

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