summary

package
v0.0.0-...-344772a Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 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 summary gives the summary of one package version of dependency code: for each exported symbol of the package, the external symbols of its own dependencies that the symbol reaches, and the uncertainties of the search. One index and one link of the package alone give it, so a job can store one summary per package version, and a project can join a call of a symbol to the summary of its package. The summary stores reach sets and no path. A caller that needs the path of one reach asks Result for it. The package owns no search rule: reach computes the sets and scopes the uncertainties, and the summary only filters and records them.

Index

Constants

View Source
const Version = "3"

Version is the version of the summary format and of the rules that fill it. Bump it when a field or a rule changes. A store keys a summary by Version, IndexVersion and LinkVersion.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Summary *Summary
	// contains filtered or unexported fields
}

Result is a summary with the graph of the unit that it comes from, so a caller can ask for the path of one reach.

func Build

func Build(ctx context.Context, indexes []*fileindex.Index, opts projectgraph.Options) (*Result, error)

Build links the indexes of one package unit alone and summarizes it. Every index and every file of opts.Files must be of the one unit, and opts.Units gives its manifests.

func (*Result) Graph

func (r *Result) Graph() *projectgraph.Graph

Graph returns the graph of the unit that the summary comes from.

func (*Result) Path

func (r *Result) Path(ctx context.Context, symbol string, target reach.Target) ([]reach.Hop, bool, error)

Path returns the shortest path from a symbol of the summary to a target that it reaches, with one search inside the unit, or false when the symbol does not reach the target. The search has no depth cap, as the sets of the summary have none, so every target of Reaches has a path. A summary stores no path, so a caller asks for one when a finding needs it.

type Summary

type Summary struct {
	Version       string            `json:"version"`
	IndexVersion  string            `json:"index_version"`
	LinkVersion   string            `json:"link_version"`
	Unit          string            `json:"unit"`
	Symbols       []Symbol          `json:"symbols"`
	Targets       []string          `json:"targets"`
	Uncertainties []reach.Scoped    `json:"uncertainties,omitempty"`
	Incomplete    []string          `json:"incomplete,omitempty"`
	Problems      []modules.Problem `json:"problems,omitempty"`
}

Summary is the summary of one package unit. Symbols are in key order. Targets holds every external symbol that the code of the unit calls, other than the symbols of the unit and the builtins of its languages, in key order. Uncertainties is the table that each symbol indexes. Incomplete lists the files of the unit with no complete index, in path order. Such a file can hold a symbol, so a symbol that Symbols does not hold is not known when Incomplete is not empty. The JSON form of one input is one byte sequence.

func Summarize

func Summarize(ctx context.Context, indexes []*fileindex.Index, opts projectgraph.Options) (*Summary, error)

Summarize links the indexes of one package unit alone and returns its summary, as Build does.

func (*Summary) Status

func (s *Summary) Status(symbol string, target reach.Target) reach.Status

Status answers whether a symbol of the summary reaches a target, as a reach query of the unit graph from the symbol answers it. The target is reached when Reaches holds a key that matches it. Otherwise an uncertainty of the symbol that concerns the target, as reach.Scoped decides it, makes it uncertain. A target that nothing concerns is not found, or no such target when the summary does not know it. A symbol that the summary does not hold is not found, unless Incomplete is not empty.

type Symbol

type Symbol struct {
	Key           string   `json:"key"`
	Definitions   []string `json:"definitions"`
	Reaches       []string `json:"reaches"`
	Uncertainties []int    `json:"uncertainties,omitempty"`
}

Symbol is one exported symbol of the package. Key is the external key that an importer writes, as lodash//template, and Definitions are the nodes of the package that the key links to. Reaches holds each target of Summary.Targets that the symbol reaches, in key order, with no depth cap. Uncertainties holds the indexes into Summary.Uncertainties of each uncertainty of the search, ascending, so a target that Reaches does not hold is not proved unreached when one of them concerns it. Status applies that rule.

Directories

Path Synopsis
Package summarytest checks a summary against the reach query of its unit graph.
Package summarytest checks a summary against the reach query of its unit graph.

Jump to

Keyboard shortcuts

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