scopes

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package scopes defines the verification scopes dmt lints in.

A scope is a source a module is read from, and it decides both which linters run and which of their rules each one is asked for. Linters and rules know nothing about scopes: a linter is handed its config and a set of rule IDs, and that is the whole of what a scope tells it. Which rules run is therefore a property of the tool, not of a module — .dmtlint.yaml tunes severities and can silence a rule with an ignored impact, but it cannot switch one on or off.

This mirrors internal/verify/lint in d8-package-plugin with the declaration inverted: there every linter exports its own scope table and gates its rules itself, so each linter has to know the scopes it lives in. Here the scope owns both tables, which is what keeps the linters unaware.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linter

type Linter interface {
	GetName() string
	Lint(ctx context.Context)
}

Linter is the common interface implemented by all lint passes. Everything a linter needs — its config, the rule IDs the scope asked it for, the module it inspects and the error list it reports into — is supplied to its constructor, so Lint takes only a context.

type Scope

type Scope string

Scope names one verification target: the source a module is read from.

const Static Scope = "static"

Static lints a module directory on disk, i.e. the full source tree as committed. A scope for a built image will join it later.

func (Scope) Linters

func (s Scope) Linters(m *modules.Module, errList *errors.LintRuleErrorsList) []Linter

Linters returns the linters this scope runs over the module, each already carrying the set of rule IDs the scope asked it for.

It takes *modules.Module rather than pkg.Module because GetModuleConfig lives on the concrete type only. That is deliberate: slicing the config per linter is the scope's job, and a linter must not be able to reach a sibling's settings.

Jump to

Keyboard shortcuts

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