Documentation
¶
Overview ¶
Package pluginselection chooses the plugins an invocation runs, from explicit source arguments or repository configuration, and verifies their artifacts.
Index ¶
- func RepositorySearchStart(path string) string
- type CachePlan
- type PluginSelection
- func (s PluginSelection) Resolve(ctx context.Context, directory string, input checkrequest.Request) (Sources, error)
- func (s PluginSelection) ResolveForRules(ctx context.Context, directory string) (Sources, error)
- func (s PluginSelection) Select(ctx context.Context, directory string, input checkrequest.Request) (Sources, error)
- func (s PluginSelection) SelectForCache(ctx context.Context, directory string, input checkrequest.Request) (Sources, error)
- type Sources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RepositorySearchStart ¶
RepositorySearchStart returns the directory from which an input path discovers its repository. A directory argument belongs to its own repository, not its parent's.
Types ¶
type PluginSelection ¶
type PluginSelection struct {
RuleSet configuration.RuleSet
Paths []string
ConfigFile string
// ConfigSources keeps the configuration files selection parses, so the
// analysis session of the same run merges them without reading them
// again. Nil reads every file for selection alone.
ConfigSources *document.Files
Disabled bool
Overlays []configuration.Overlay
// DefaultTools lists bundled linters that use registry plugins when configuration omits plugins.
DefaultTools []string
DisableTools bool
// WithTools copies DisabledTools and NamedTools.
DisabledTools, NamedTools []string
Acquisition dependencycache.Acquisition
// contains filtered or unexported fields
}
PluginSelection chooses plugins from explicit arguments or repository configuration. Explicit sources replace automatic selection. Explicit configs are invocation-wide; automatic declarations belong to their nearest repository.
func WithTools ¶
func WithTools(selection PluginSelection, disabled, named []string) PluginSelection
WithTools returns a copy of selection that stores the tool ids disabled by --no-tool or the GitHub Action's disable-tools input, and the tool ids named by --tool, --no-tool or that input. A selected plugin whose name or alias is a disabled id is never downloaded. Any other plugin is skipped before it runs when its metadata names a disabled id as its engine or one of its rules. After plugins load, each named id must name a bundled tool, a loaded plugin or a skipped plugin.
func (PluginSelection) Resolve ¶
func (s PluginSelection) Resolve(ctx context.Context, directory string, input checkrequest.Request) (Sources, error)
func (PluginSelection) ResolveForRules ¶
ResolveForRules selects declared plugins without validating unrelated lint settings.
func (PluginSelection) Select ¶
func (s PluginSelection) Select(ctx context.Context, directory string, input checkrequest.Request) (Sources, error)
Select resolves exact registry metadata without downloading artifacts or running plugin code. Hosts can restore artifacts before Hydrate verifies them.
func (PluginSelection) SelectForCache ¶
func (s PluginSelection) SelectForCache(ctx context.Context, directory string, input checkrequest.Request) (Sources, error)
SelectForCache selects the same declared releases as analysis without fetching artifacts or implicitly migrating project files.
type Sources ¶
type Sources struct {
Paths []string
LazySources map[string]pluginregistry.Pin
RepositoryRoot string
RepositoryScoped bool
Releases *pluginregistry.ResolvedPlugins
Configurations []*configuration.Config
Artifacts map[string]*artifacts.Artifact
// NetworkGrants come only from explicit source arguments, never project files.
NetworkGrants map[string]acquisitionhttp.Grant
Overlays []configuration.Overlay
// DisabledTools and NamedTools carry the invocation selections to loading.
DisabledTools, NamedTools []string
// SkippedTools lists disabled tool ids that matched a selected plugin.
SkippedTools []string
DisableTools bool
// Configured identifies configuration-selected providers that require process opt-in.
Configured bool
Acquisition dependencycache.Acquisition
}
Sources records selected plugin references, release data and acquisition authority.
func SourcesFromArguments ¶
func SourcesFromArguments(paths []string, acquisition dependencycache.Acquisition) (Sources, error)
SourcesFromArguments copies plugin paths and grants network access to the endpoint of each explicitly supplied remote source.
func (*Sources) ArtifactOptions ¶
ArtifactOptions supplies cache settings and the grant attached to source.
func (*Sources) CachePlan ¶
CachePlan may acquire OCI manifests to enumerate this host's verified blobs. It never fetches executable layers or executes plugins. Configuration backends are included so their pinned bytes can be restored before runtime loading.
func (*Sources) ValidateScope ¶
func (s *Sources) ValidateScope(ctx context.Context, rules configuration.RuleSet, paths []string) error
ValidateScope prevents a session's automatic project plugins from being applied to documents opened from another (including nested) repository.