Skip to main content

CheckSourceConfig

Enum CheckSourceConfig 

Source
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

Fields

§command: String
§

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: String

Name of the plugin binary to invoke. name = "my-linter" resolves to klasp-plugin-my-linter on $PATH.

§args: Vec<String>

Optional extra arguments forwarded to the plugin on every --gate invocation. Plugins receive these inside PluginGateInput.

§settings: Option<Value>

Optional opaque config block forwarded verbatim to the plugin inside PluginGateInput.config.settings. Plugins may define any schema here; klasp treats it as a JSON blob.

§

PreCommit

Fields

§hook_stage: Option<String>

Maps to pre-commit run --hook-stage <stage>. None defaults to "pre-commit" at run time, matching pre-commit’s own default when invoked from a .git/hooks/pre-commit shim.

§config_path: Option<PathBuf>

Maps to pre-commit run -c <config_path>. None lets pre-commit fall back to its own default discovery (.pre-commit-config.yaml at the repo root).

§

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.

§config_path: Option<PathBuf>

Maps to pytest -c <config_path>. None lets pytest fall back to its own discovery (pytest.ini, pyproject.toml, tox.ini, …).

§junit_xml: Option<bool>

When true, the recipe asks pytest to write a JUnit XML report and parses it for per-failure findings. When false (default), the recipe falls back to a generic count-based finding from pytest’s exit code alone.

§

Cargo

Fields

§subcommand: String

Required: 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).

§extra_args: Option<String>

Free-form extra args appended after cargo’s own flags (e.g. "--all-features"). None runs cargo with its own defaults.

§package: Option<String>

Maps to cargo <sub> -p <package>. None runs across the workspace via --workspace.

Trait Implementations§

Source§

impl Clone for CheckSourceConfig

Source§

fn clone(&self) -> CheckSourceConfig

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 Debug for CheckSourceConfig

Source§

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

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

impl<'de> Deserialize<'de> for CheckSourceConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CheckSourceConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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<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, 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,