manifests

package
v0.166.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package manifests recognizes the files in a tree that declare or pin dependencies, and accounts for the ones a dependency scan did not read.

One list for every reader: a scanner deciding whether resolving nothing was a real answer, a scan reporting what it left unread, and `draugr init` deciding what a tree needs. Kept apart they disagree about what counts as a manifest, and each disagreement is a file one of them is silent about.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatOf added in v0.135.0

func FormatOf(rel string) string

FormatOf names the format a path is, as Formats lists it, or "" for a path no rule recognizes. A member of a family named by one entry, requirements-dev.txt or pylock.dev.toml, is that entry. Content is not read, so a file that declares nothing still has a format.

func IsLockfile added in v0.147.0

func IsLockfile(rel string) bool

IsLockfile reports whether a path is a lockfile, by the format FormatOf names for it.

func LicensesNotRead added in v0.166.1

func LicensesNotRead(packages int, command string) string

LicensesNotRead is the reason for a dependency file whose packages a license scan read with none of their licenses. With no command, the file is all the scanner reads and it records none, as `records no licenses for 3 packages`. With one, the licenses are in a cache the command fills, as `licenses of 3 packages not read, run dotnet restore`.

func ParseLicensesNotRead added in v0.166.1

func ParseLicensesNotRead(reason string) (packages int, command string, ok bool)

ParseLicensesNotRead reads a reason LicensesNotRead wrote back into its packages and command, and reports false for any other reason. A reason for several files is the same sentence over their packages, so a report that folds them into one row reads each one's count here.

func ScannerLimit added in v0.166.1

func ScannerLimit(reason string) bool

ScannerLimit reports whether reason describes what a scanner cannot read under any setting, rather than something the reader can change. Where several scanners read one file in part, another scanner's reason is shown in place of such a reason, since it can name the act that clears the row.

Types

type File

type File struct {
	// Path is slash-separated and relative to the root that was searched.
	Path      string
	Ecosystem string
	Kind      Kind
}

File is one dependency file found in a tree.

func Find

func Find(root string) []File

Find returns the dependency files under root, in path order. A file whose content names no dependency is left out.

type Format added in v0.135.0

type Format struct {
	// Name is the file's base name, or `*` and a suffix for a family such as `*.csproj`.
	Name      string
	Ecosystem string
	Kind      Kind
}

Format is one name of dependency file Draugr recognizes.

func Formats added in v0.135.0

func Formats() []Format

Formats lists every name of dependency file the rules recognize, in rule order.

type Kind

type Kind int

Kind separates a file that names dependencies from one that pins them.

const (
	// Pinned lists exact versions, and a scanner reads packages from it directly: a lockfile,
	// requirements.txt, go.mod, pom.xml.
	Pinned Kind = iota
	// Declared names dependencies without resolving them, so a scanner needs the lockfile beside
	// it: package.json, pyproject.toml, Cargo.toml, a .csproj.
	Declared
)

type Reason

type Reason string

Reason is why a dependency file contributed no packages to a scan.

const (
	// NoLockfile is a declared manifest with no lockfile beside it or above it.
	NoLockfile Reason = "no lockfile"
	// Unpinned is a requirements file whose entries name no exact version.
	Unpinned Reason = "no pinned versions"
	// NotRead is a file the scan read no packages from: a name its scanner does not read, or a
	// format it does not support.
	NotRead Reason = "no packages read"
	// TransitiveNotReadByGrype is a pom.xml Grype read in part. Grype reads no dependency's own pom
	// whatever the local Maven repository holds, so no action of the reader's clears it, and it names
	// none. Another scanner's reason for the same file is shown in its place (see ScannerLimit).
	TransitiveNotReadByGrype Reason = "transitive dependencies not read by Grype"
)

func PartlyPinned added in v0.165.5

func PartlyPinned(root, rel string, packages int) (Reason, bool)

PartlyPinned is the reason a requirements file a scanner took packages from was read in part: the requirements in it with no exact version, as `1 requirement not pinned: urllib3`, or `29 requirements not pinned` past namedInReason. Trivy and Grype take a package from a requirements file only where its version is pinned with `==`.

Trivy with detectionPriority: comprehensive also takes a range at its minimum version. Where the scanner took more packages than the file pins, which requirements it passed over is not recorded, and the reason counts them, as `2 requirements not read`.

ok is false for a file that is not a requirements file or pins every requirement, for one the scanner took as many packages from as it has requirements, and for one it took none from, which Account reports.

type Unread

type Unread struct {
	Path   string
	Reason Reason
}

Unread is a dependency file a scan did not read, and why.

func Account

func Account(root string, read map[string]bool) []Unread

Account returns the dependency files under root that are not in read, each with the reason it contributed nothing.

read holds slash-separated paths relative to root, as a scanner names the files it took packages from. A declared manifest resolved by a lockfile is not unread: the lockfile is what a scanner reads for it, and reporting both would warn about every project that is set up correctly.

A lockfile resolves its manifest when the walk holds it, so that it is reported itself if no scanner reads it, or when the walk left it out as the format with nothing in it. A file merely named like a lockfile does neither, because resolving on the name alone would leave the manifest and the lockfile both unreported with nothing read from either.

Jump to

Keyboard shortcuts

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