Documentation
¶
Overview ¶
Package linters tells the languages a repository holds from its tracked files and, for each, the tools that read it by kind and those it lacks (ADR-0049, step 1). What the project runs counts first, then the language's own toolchain (ecosystem.go), then trunk-io/plugins' table (MIT, trunk.json, regenerated by go generate). docs/languages.md says the rules.
Index ¶
Constants ¶
const ( Lint = "lint" Types = "types" Security = "security" Dependencies = "dependencies" )
The kinds a tool reads a language for, in the order they are said.
Variables ¶
var Kinds = []string{Lint, Types, Security, Dependencies}
Kinds are the kinds, in order.
Functions ¶
Types ¶
type Language ¶
type Language struct {
Name string `json:"name"`
Files []string `json:"files"` // tracked, neither vendored nor generated
Shebang int `json:"shebang"` // of them, told by their #! line only
// Running: kind -> the tools the project runs that read it.
Running map[string][]Seen `json:"running,omitempty"`
// Missing: kind -> the tools suggested, in order, when none runs.
Missing map[string][]Suggestion `json:"missing,omitempty"`
// Unsuggested: when nothing reads it and nothing is suggested, the
// tools that would, each with the config it needs.
Unsuggested []Suggestion `json:"unsuggested,omitempty"`
// contains filtered or unexported fields
}
Language is one language a repository holds, and what reads it.
type Report ¶
type Report struct {
Tracked int `json:"tracked"`
Skipped int `json:"skipped"` // vendored or generated
Languages []Language `json:"languages"`
}
Report is what was read of a repository.
type Suggestion ¶
type Suggestion struct {
Tool string `json:"tool"`
Version string `json:"version,omitempty"`
Config string `json:"config,omitempty"` // the config the repository holds; for Unsuggested, the one it lacks
Check string `json:"check,omitempty"` // a gate check, as YAML; empty when its command is not known
// Each: the check runs once from a folder, and its config is in
// subfolders only (platformio.ini): one check from each.
Each string `json:"each,omitempty"`
}
Suggestion is a tool to run, and the gate check that runs it.
type Suppression ¶ added in v0.36.0
type Suppression struct {
Name string // as it is written: //nolint
Tools []string // the tools it silences, by the table's names
Exts []string // the files it is read in
// contains filtered or unexported fields
}
Suppression is a comment that hides a tool's finding from it, in the files of its language.
func Suppressed ¶ added in v0.36.0
func Suppressed(file, text string, tools []string) (Suppression, bool)
Suppressed says the suppression a line of a file holds, for one of the tools given; false when it holds none.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Reads map[string][]string `json:"reads"` // kind -> file types
Suggest string `json:"suggest"` // files: whenever its files are there; config: only with its config; never
Configs []string `json:"configs,omitempty"`
Version string `json:"version,omitempty"` // the one trunk tested
SeenAs []string `json:"seen-as"` // what a project runs it by
Run string `json:"run,omitempty"` // a gate check's command; empty: not known
OnFiles bool `json:"on-files,omitempty"`
}
Tool is a tool that reads files of some types.
Directories
¶
| Path | Synopsis |
|---|---|
|
Command gen writes trunk.json, the extract of trunk-io/plugins (MIT) internal/linters reads, regenerated, never edited (docs/languages.md):
|
Command gen writes trunk.json, the extract of trunk-io/plugins (MIT) internal/linters reads, regenerated, never edited (docs/languages.md): |