linters

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 16 Imported by: 0

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

View Source
const (
	Lint         = "lint"
	Types        = "types"
	Security     = "security"
	Dependencies = "dependencies"
)

The kinds a tool reads a language for, in the order they are said.

Variables

Kinds are the kinds, in order.

Functions

This section is empty.

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.

func Read

func Read(repo string) (*Report, error)

Read tells the languages of the repository at repo, its git root, and what reads each.

type Seen

type Seen struct {
	Tool  string `json:"tool"`
	Where string `json:"where"`
}

Seen is a tool the project runs, and where it was found.

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 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):

Jump to

Keyboard shortcuts

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