Documentation
¶
Overview ¶
Package scan finds the tool versions a project pins (mise, asdf, aqua, Terraform, Dockerfiles, CI files and more) and maps each raw name to a registry tool.
Index ¶
Constants ¶
const ( DetectorMise = "mise" DetectorToolVersions = "tool-versions" DetectorAqua = "aqua" DetectorIdiomatic = "idiomatic" DetectorTerraform = "terraform" DetectorTFLock = "tf-lock" DetectorTerragrunt = "terragrunt" DetectorDockerfile = "dockerfile" DetectorCI = "ci" DetectorHelm = "helm" DetectorGeneric = "generic" DetectorRenovate = "renovate" )
Detector names, as shown in Location.Detector.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Ignore ¶
type Ignore struct {
Tool string // a tool name as Pin.Tool holds it
Path string // glob on repo/file, ** for any directories; empty matches every file
}
Ignore drops the pins of one tool, everywhere or only in files under a glob.
type Location ¶
type Location struct {
Repo string `json:"repo"` // repository directory, slash-separated
File string `json:"file"` // relative to Repo, slash-separated
Line int `json:"line"` // 0 when the source has no lines, as in a Renovate report
Detector string `json:"detector"`
}
Location is where a pin was found.
type Namer ¶
Namer maps a raw name to a tool name and is safe for concurrent use; [registry.Resolver] implements it.
type Options ¶
type Options struct {
Exclude []string // globs on repository-relative paths, ** for any directories
ExtraFiles []string // globs the generic detector reads
Generic bool // run the generic detector on ExtraFiles
Actions bool // report `uses: owner/action@ref` in CI files
Submodules bool // scan checked-out submodules as repositories
Concurrency int // files read at once; 0 means 4 per CPU
Report []Pin // pins from a Renovate report, resolved and merged with the rest
Base string // when set, repositories are named relative to it, as if the scan ran there
}
Options configures a Scanner.
type Pin ¶
type Pin struct {
Tool string `json:"tool"` // name `relgap digest` accepts; empty when unresolved
RawName string `json:"raw_name"` // as written: TERRAFORM_VERSION, hashicorp/aws, http:kafka
Kind Kind `json:"kind"`
Value string `json:"value"` // as written
Version string `json:"version"` // Value without a leading v or go, for comparison
Exact bool `json:"exact"`
Match Match `json:"match"`
Location Location `json:"location"`
// contains filtered or unexported fields
}
Pin is one tool version found in a file.
func RenovateReport ¶
RenovateReport reads the JSON report Renovate writes with --report-type=file. packageFiles may sit at the top level or under repositories.<name>. Unknown fields are ignored. Pins carry no line, because Renovate reports none.
type Problem ¶
type Problem struct {
Repo string `json:"repo"`
File string `json:"file"`
Message string `json:"message"`
}
Problem is a file that couldn't be parsed.
type Result ¶
type Result struct {
Repos []string `json:"repos"`
Pins []Pin `json:"pins"`
Problems []Problem `json:"-"`
}
Result is what a scan found, sorted.
type Runner ¶
Runner starts git; execx.Runner implements it.