fensu-rust analyzer and run through the normal
fensu command. There is no separate Rust command or policy file.
Configure a workspace
Add a named target tofensu.toml:
rule_packs = ["rust"] and select = ["FPRS"] are the Rust defaults. Keeping
them explicit makes the active policy clear in a multi-target repository.
Then run:
roots = ["src"]. If the Cargo project is below
the repository root, set root to that directory. Target paths are relative to
root.
Cargo discovers workspace members, package names, library and binary targets, and
integration-test targets automatically. You do not need to list crates unless you
deliberately want a closed inventory. Rust targets reject positional paths because
Cargo owns target discovery.
By default, Cargo-inferred crate source roots are also the ownership roots from
which Fensu classifies domains. Set
ownership_roots only when a crate’s
domains begin below additional structural grouping directories.
What it checks
Therust pack exposes all 117 implemented rules under FPRS. The rules cover:
- Cargo workspace and dependency policy;
- module ownership, visibility, layout, and import boundaries;
- file, function, naming, and error-handling hygiene;
- function shape and coordination budgets; and
- unit and integration-test structure and conventions.
Cargo.toml; they do not use Python
definition selectors. Inspect any rule and its effective settings with:
Custom Rust rules
Custom Rust rules are authored in Python but run over immutable, serialized facts owned by Fensu. Declare Rust applicability explicitly and use a typedFile or
Project subject; raw syn and Cargo metadata objects are never exposed.
ctx.rust includes Cargo workspace crates, targets and dependencies; selected Rust
files and module identities; declarations for functions, structs, enums, traits,
implementations, visibility and derives; parse failures; and statically provable
use targets. Resolution remains explicit when a target is external, crate-local
but not attributable to one file, or unresolved.
Project rules use Project and run once for the Rust target. They can combine
ctx.project.tree with ctx.rust.crates for workspace-wide dependency or layout
policy. Typed rule_options, warning tiers, selector ignores, path ignores and exact
exceptions use the same configuration as built-in rules.
Fensu starts the Python host only when configured custom-rule sources have an active
X selector that is not wholly covered by an ignore prefix. A Rust target with only
native selectors remains native and Python-free. Cacheable custom rules retain
separate file or project subjects and replay the tree or Rust-fact queries actually
observed by each invocation. Fact schema, parser contract, runtime, rule package and
typed options all participate in cache identity.
Rule options
Adjust a rule under the target’s standardrule_options table:
Budgets must be positive integers. Unknown rule codes, option names, and invalid
value types are rejected instead of being silently ignored.
Tooling and repository boundaries
Use the target’s normaltooling paths to identify tooling crates:
forbidden_packages prevents runtime
crates outside those paths from depending on the named tooling packages and defaults
to an empty list.
Parser boundaries are also explicit and repository-neutral by default:
packages defaults to an empty list and restricted_paths defaults to ["rules"].
Dependency aliases are resolved when matching package identities.
Closed inventories are optional:
Cargo metadata and caching
Rust sources, Cargo manifests, an existing lockfile, and target configuration are cache inputs. Selected custom-rule packages are cache inputs as well. Fensu uses locked dependency resolution whenCargo.lock exists.
For a lock-free workspace, it reads declared dependencies without creating a
lockfile.
If Cargo metadata cannot be read, Fensu reports a setup diagnostic and does not cache
the result. The result remains uncached even when rule selection hides that diagnostic.
