pub enum CheckSourceConfig {
Shell {
command: String,
},
Plugin {
name: String,
args: Vec<String>,
settings: Option<Value>,
},
PreCommit {
hook_stage: Option<String>,
config_path: Option<PathBuf>,
},
Fallow {
config_path: Option<PathBuf>,
base: Option<String>,
},
Pytest {
extra_args: Option<String>,
config_path: Option<PathBuf>,
junit_xml: Option<bool>,
},
Cargo {
subcommand: String,
extra_args: Option<String>,
package: Option<String>,
},
}Expand description
Tagged enum: TOML type = "shell" selects the Shell variant,
type = "pre_commit" selects the v0.2 W4 PreCommit named recipe,
type = "fallow" selects the v0.2 W5 Fallow named recipe,
type = "pytest" selects the v0.2 W6 Pytest named recipe,
type = "cargo" selects the v0.2 W6 Cargo named recipe.
type = "plugin" selects the v0.3 subprocess plugin model — the plugin
binary is identified by the required name field (e.g. name = "my-linter"
maps to the klasp-plugin-my-linter binary on $PATH).
Unknown type values (other than the above) fail at parse time — that’s
the v0.1 contract for additive forwards-incompatibility, preserved as
new recipes land.
Adding new variants is the v0.2 named-recipe extension point —
each new recipe is a sibling variant here plus a paired CheckSource
impl in the binary crate. Field shape is per-recipe: Shell carries
a free-form command, PreCommit carries optional hook_stage /
config_path fields, Fallow carries optional config_path /
base fields, Pytest carries optional extra_args, config_path,
and junit_xml toggle, Cargo requires a subcommand plus optional
extra_args / package. verdict_path is deferred — see
[docs/design.md §14] for the explicit scope note.
Variants§
Shell
Plugin
v0.3 subprocess plugin. The plugin binary klasp-plugin-<name> is
discovered lazily on $PATH when the gate encounters this config.
args is an optional list of extra arguments passed to the plugin on
every --gate invocation; settings is an optional opaque JSON object
forwarded verbatim inside PluginGateInput.config.settings so the
plugin can consume arbitrary config without klasp knowing its schema.
Fields
name: StringName of the plugin binary to invoke. name = "my-linter" resolves
to klasp-plugin-my-linter on $PATH.
PreCommit
Fields
Fallow
Fields
config_path: Option<PathBuf>Maps to fallow audit -c <config_path>. None lets fallow
fall back to its own discovery (.fallowrc.json,
.fallowrc.jsonc, or fallow.toml at the repo root).
base: Option<String>Maps to fallow audit --base <ref>. None falls back to
${KLASP_BASE_REF} at run time, which the gate runtime
resolves to the merge-base of HEAD against the upstream
tracking branch. Set this only when the diff-base for the
audit should diverge from the gate’s resolved base ref —
e.g. auditing against a fixed mainline for a long-lived
release branch.
Pytest
Fields
extra_args: Option<String>Free-form extra args appended after pytest’s own flags.
e.g. "-x -q tests/integration". None runs pytest with
its own defaults.
Cargo
Fields
subcommand: StringRequired: which cargo <subcommand> to dispatch. Accepted
values are "check", "clippy", "test", "build". Any
other value fails at run time with an unparseable detail
(the schema doesn’t enum-restrict this so a future cargo
subcommand can be tried by an adventurous user without a
klasp release).
Trait Implementations§
Source§impl Clone for CheckSourceConfig
impl Clone for CheckSourceConfig
Source§fn clone(&self) -> CheckSourceConfig
fn clone(&self) -> CheckSourceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more