Skip to main content

IssueCode

Enum IssueCode 

Source
pub enum IssueCode {
Show 20 variants UndefinedCommand, MissingRequiredArg, UnknownFlag, InvalidArgType, SeqZeroIncrement, InvalidRegex, BreakOutsideLoop, ReturnOutsideFunction, PossiblyUndefinedVariable, ForLoopScalarVar, ScatterWithoutGather, LastResultFieldAccess, DiffNeedsTwoFiles, InvalidSedExpr, InvalidJqFilter, LvalueUndefinedRoot, DottedAssignmentTarget, UnreadableAssignmentTarget, InvisibleAssignmentTarget, MixedScriptName,
}
Expand description

Categorizes validation issues for filtering and tooling.

Variants§

§

UndefinedCommand

Command not found in registry or user tools.

§

MissingRequiredArg

Required parameter not provided.

§

UnknownFlag

Flag not defined in tool schema.

§

InvalidArgType

Argument type doesn’t match schema.

§

SeqZeroIncrement

seq increment is zero (infinite loop).

§

InvalidRegex

Regex pattern is invalid.

§

BreakOutsideLoop

break/continue outside of a loop.

§

ReturnOutsideFunction

return outside of a function.

§

PossiblyUndefinedVariable

Variable may be undefined.

§

ForLoopScalarVar

Bare scalar variable in for loop (no word splitting in kaish).

§

ScatterWithoutGather

scatter without gather — parallel results would be lost.

§

LastResultFieldAccess

Field access on $? (e.g. ${?.data}, ${?.ok}) was removed. $? is the POSIX exit code; use kaish-last for structured data.

§

DiffNeedsTwoFiles

diff was given other than two file operands.

§

InvalidSedExpr

sed expression is syntactically invalid.

§

InvalidJqFilter

jq filter expression is syntactically invalid.

§

LvalueUndefinedRoot

A subscripted assignment lvalue (x[k]=v) targets an undefined root variable. Unlike a plain read, a path-set never autovivifies the root — it must already exist as a collection.

§

DottedAssignmentTarget

An assignment target contains a dot (user.email=x). kaish is brackets-only for collection access — the Ident token admits . for other uses (filenames, source foo.kai), so this is caught here rather than by tightening the lexer regex.

§

UnreadableAssignmentTarget

An assignment target contains # (abc#3=5). The Ident token admits # so words, ids, and URLs keep it, but $abc#3 is itself an error, so such a variable could be created and never read back. Caught here rather than by tightening the lexer regex, for the same reason DottedAssignmentTarget is.

§

InvisibleAssignmentTarget

An assignment target holds a character that does not show itself — whitespace, a zero-width character, or a bidi control. Most spellings are caught earlier, on the token stream; this covers the ones only the syntax tree can tell apart from data, such as the second assignment in an env-scoped prefix (x=1 BAD=2 cmd), where a target and an argv key=value word look identical one token back.

§

MixedScriptName

A name is spelled in two scripts, so it reads as a name it does not bind — PАTH with CYRILLIC CAPITAL LETTER A (U+0410) binds a second variable and leaves $PATH alone. UAX #39’s Highly Restrictive profile is the rule, so café, 名前, and 変数x stay quiet. A warning, never an error: the name binds either way, and the author is the only one who knows which name they meant.

Implementations§

Source§

impl IssueCode

Source

pub fn code(&self) -> &'static str

Returns a short code string for the issue.

Code numbers are stable identifiers, not contiguous. E010 and W003/W004/W005 remain retired, as does W006 (PosixTestCommand, retired when test became a first-class builtin) — W007 is the next free warning number, not a reuse of one of them. E006 (InvalidSedExpr), E007 (InvalidJqFilter), and E011 (DiffNeedsTwoFiles) were wired up with real emitters in 2026-06-14.

Source

pub fn surfaces_to_agent(&self) -> bool

Whether a warning carrying this code should be surfaced to the agent (appended to the result’s stderr) rather than only trace-logged.

Most warnings stay trace-only — UndefinedCommand fires on every external command (grep, cargo), so surfacing them all would be noise. Opt a code in here only when its guidance is worth interrupting for; this is the boundary between the two.

MixedScriptName is opted in. It reports a name whose spelling and binding disagree, which nothing else reports — the exit code is 0 and the output looks right — so a trace-only warning would report it to nobody. Add a code to the matches! arm when the same is true of it.

Source

pub fn default_severity(&self) -> Severity

Default severity for this issue code.

Trait Implementations§

Source§

impl Clone for IssueCode

Source§

fn clone(&self) -> IssueCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for IssueCode

Source§

impl Debug for IssueCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for IssueCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for IssueCode

Source§

impl PartialEq for IssueCode

Source§

fn eq(&self, other: &IssueCode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for IssueCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.