#[non_exhaustive]pub enum Finding {
UnknownArg {
arg: String,
did_you_mean: Option<String>,
},
OutOfScope {
arg: String,
command: Option<String>,
applies_to: Vec<String>,
},
UnknownEnv {
name: String,
did_you_mean: String,
},
MissingValue {
arg: String,
},
UnexpectedValue {
arg: String,
},
InvalidValue {
key: String,
source: Source,
value: String,
reason: String,
},
UnknownToken {
key: String,
token: String,
allowed: Vec<String>,
},
MissingRequired {
key: String,
via: Vec<String>,
},
Deprecated {
key: String,
guidance: String,
},
}Expand description
Something wrong with an invocation, relative to the declared contract.
This enum is #[non_exhaustive]: a new kind of finding can be added in a minor release, so a
match on it needs a wildcard arm. Ask Finding::severity or a LintPolicy how serious
one is instead of matching on its kind.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnknownArg
A flag was given that no input declares.
Fields
OutOfScope
A flag was given that is declared, but only for other subcommands than the one running.
Flags are parsed globally, so without this finding delete --dry-run would be accepted
and the flag silently ignored by delete, which is the worst place for a “preview” flag
to be ignored.
Fields
UnknownEnv
A variable is set that no input declares, but which closely resembles one that exists.
Only near-misses are reported: an environment holds hundreds of unrelated
variables, and a checker that mentions PATH is a checker nobody runs.
Fields
MissingValue
A flag that takes a value was given none.
UnexpectedValue
A flag that takes no value was given one.
InvalidValue
A declared input received a value outside its domain.
Fields
UnknownToken
A token in a list value is not among the declared tokens.
Fields
MissingRequired
A required input was not supplied and has no default. An input scoped to subcommands counts as required only when one of those subcommands is running.
Deprecated
A deprecated input is in use.
Implementations§
Source§impl Finding
impl Finding
Sourcepub fn severity(&self) -> Severity
pub fn severity(&self) -> Severity
How seriously to take this finding under the default, strict, LintPolicy. A program
with different needs asks its own policy: LintPolicy::severity.