Documentation
¶
Overview ¶
Package diag holds the diagnostic type every layer reports findings in, the quick-fix edits a diagnostic carries, and the conformance mode that decides how strictly findings are judged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConformanceMode ¶
type ConformanceMode int
ConformanceMode is how strictly a document is judged against the pinned SysML v2 and KerML grammars. It is threaded explicitly through the analysis pipeline — no global, no environment read — so every entry point states the question it is asking.
const ( // ConformanceDefault accepts the OpenSysML notation extensions, reporting each as a // warning. It is the zero value: a caller that says nothing gets it. ConformanceDefault ConformanceMode = iota // ConformanceStrict answers "is this conforming SysML v2?": notation no pinned // production admits is an error, so a file using it is rejected. ConformanceStrict )
func ConformanceModeOf ¶
func ConformanceModeOf(strict bool) ConformanceMode
ConformanceModeOf maps a boolean surface (a CLI flag, an LSP setting, a request field) onto the mode it selects.
func ParseConformanceMode ¶
func ParseConformanceMode(s string) (ConformanceMode, error)
ParseConformanceMode reads a mode by name, as the CLI and the REPL spell it. The empty string is the default mode, so an unset setting is not an error.
func (ConformanceMode) IsStrict ¶
func (m ConformanceMode) IsStrict() bool
IsStrict reports whether extension notation is an error in this mode.
func (ConformanceMode) String ¶
func (m ConformanceMode) String() string
String returns the mode's spelling, the same one every entry point accepts.
type Diagnostic ¶
type Diagnostic struct {
Severity Severity
Span source.Span
Message string
Code string // stable identifier for filtering / quick-fix selection
Source string // the pass ID that produced this diagnostic
// Fixes are the unambiguous edits resolving the diagnostic, offered by an
// editor as quick fixes.
Fixes []Fix
// Notation marks a finding about how the model is written rather than about
// what it means: the document still reads, so it does not gate higher tiers.
Notation bool
}
Diagnostic is a single validation finding produced by a pass.
func Clone ¶ added in v0.9.2
func Clone(ds []Diagnostic) []Diagnostic
Clone returns a copy of ds sharing no slice with it.
func (Diagnostic) Blocking ¶
func (d Diagnostic) Blocking() bool
Blocking reports whether the finding stops what depends on the model being readable — a higher validation tier, a summary of what a submission declared. A notation error is about the writing, not the meaning, so it stops neither.
type Edit ¶
type Edit struct {
Span source.Span
NewText string
// OwnLine makes the edit a whole line inserted before Span.Offset, indented
// like the line that offset sits on (see Render).
OwnLine bool
}
Edit replaces the text a span covers. A zero-length span is an insertion at its offset.
func InsertLine ¶
InsertLine returns an insertion of text as its own line before offset.