#[non_exhaustive]pub struct ValidationIssue {
pub severity: Severity,
pub code: IssueCode,
pub message: String,
pub span: Option<Span>,
pub suggestion: Option<String>,
pub command: Option<String>,
}Expand description
A validation issue found in the script.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.severity: SeveritySeverity level.
code: IssueCodeIssue category code.
message: StringHuman-readable message.
span: Option<Span>Optional source location.
suggestion: Option<String>Optional suggestion for fixing the issue.
command: Option<String>The command this issue concerns, when one is genuinely known.
Some(name) when a name is on hand: a builtin’s own Tool::validate
raising about itself, a schema-driven argument issue (the schema’s
name), a wrapped command’s refusal, UndefinedCommand’s unresolved
name, scatter without a gather, and a user tool’s arity failure.
None, never a placeholder, when the issue is not about a command at
all — an assignment target, a bare break, an undefined variable, or
MixedScriptName, where the mis-spelled name is the argument.
Severity varies: UndefinedCommand is a Warning and so never reaches
KernelError::Validation, which kaish-kernel filters to Error.
Reading it means driving the Validator directly.
One limit: schema-driven issues record the SCHEMA’s name, which equals the invoked name for every builtin (pinned by a registry test) but is not enforced for a tool an embedder registers.
Route on code, then narrow by command; don’t parse message to
recover a name this field already gives you.
Implementations§
Source§impl ValidationIssue
impl ValidationIssue
Sourcepub fn error(code: IssueCode, message: impl Into<String>) -> ValidationIssue
pub fn error(code: IssueCode, message: impl Into<String>) -> ValidationIssue
Create a new validation error.
Sourcepub fn warning(code: IssueCode, message: impl Into<String>) -> ValidationIssue
pub fn warning(code: IssueCode, message: impl Into<String>) -> ValidationIssue
Create a new validation warning.
Sourcepub fn with_span(self, span: Span) -> ValidationIssue
pub fn with_span(self, span: Span) -> ValidationIssue
Add a span to this issue.
Sourcepub fn with_suggestion(self, suggestion: impl Into<String>) -> ValidationIssue
pub fn with_suggestion(self, suggestion: impl Into<String>) -> ValidationIssue
Add a suggestion to this issue.
Sourcepub fn with_command(self, command: impl Into<String>) -> ValidationIssue
pub fn with_command(self, command: impl Into<String>) -> ValidationIssue
Record the command this issue concerns.
Call this only where the name is genuinely known at the construction
site — the tool being validated, or the unresolved name itself for
UndefinedCommand. Leave it unset rather than guess.
Trait Implementations§
Source§impl Clone for ValidationIssue
impl Clone for ValidationIssue
Source§fn clone(&self) -> ValidationIssue
fn clone(&self) -> ValidationIssue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidationIssue
impl Debug for ValidationIssue
Auto Trait Implementations§
impl Freeze for ValidationIssue
impl RefUnwindSafe for ValidationIssue
impl Send for ValidationIssue
impl Sync for ValidationIssue
impl Unpin for ValidationIssue
impl UnsafeUnpin for ValidationIssue
impl UnwindSafe for ValidationIssue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.