pub struct RulePackDef {
pub schema: Option<String>,
pub version: u32,
pub name: String,
pub description: Option<String>,
pub rules: Vec<RulePackRule>,
}Expand description
A declarative rule pack loaded from a standalone JSON or JSONC file listed
in the rulePacks config key.
Rule packs are pure data: loading a pack never executes project code. They
encode project-specific policy (banned calls, banned imports, and
catalogue-backed banned effects) evaluated over fallow’s static extraction
data, reporting as policy-violation
findings.
{
"$schema": "https://raw.githubusercontent.com/fallow-rs/fallow/main/rule-pack-schema.json",
"version": 1,
"name": "team-policy",
"description": "House rules for the platform team",
"rules": [
{
"id": "no-child-process",
"kind": "banned-call",
"callees": ["child_process.*"],
"message": "Use the sandboxed runner instead.",
"severity": "error"
},
{
"id": "no-network",
"kind": "banned-effect",
"effects": ["network"],
"message": "Keep this package side-effect free."
},
{
"id": "no-moment",
"kind": "banned-import",
"specifiers": ["moment"],
"message": "Use date-fns."
}
]
}Fields§
§schema: Option<String>JSON Schema reference (ignored during deserialization).
version: u32Pack format version. Must be 1; the field exists so future rule
kinds can be added without breaking older fallow builds silently.
name: StringPack name, unique across all loaded packs. Must use only ASCII
letters, digits, ., _, and - so "<pack>/<id>" is unambiguous in
output, baselines, and scoped suppression comments.
description: Option<String>Optional human description of the pack’s intent.
rules: Vec<RulePackRule>The policy rules this pack enforces. Must be non-empty: an empty pack would silently enforce nothing.
Implementations§
Source§impl RulePackDef
impl RulePackDef
Sourcepub fn json_schema() -> Value
pub fn json_schema() -> Value
Generate JSON Schema for the rule-pack format (consumed by
fallow rule-pack-schema for editor autocomplete).
Trait Implementations§
Source§impl Clone for RulePackDef
impl Clone for RulePackDef
Source§impl Debug for RulePackDef
impl Debug for RulePackDef
Source§impl<'de> Deserialize<'de> for RulePackDef
impl<'de> Deserialize<'de> for RulePackDef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RulePackDef
impl JsonSchema for RulePackDef
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more