Skip to main content
Fensu analyzes Rust projects natively. Cargo discovery, Rust parsing, workspace facts, and all Rust rules are owned by the 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 to fensu.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:
For a single Cargo package, use 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.

What it checks

The rust 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.
Use the normal selectors and policy tiers:
Exact file exceptions and path-scoped ignores work as they do for other analyzers. Rust exceptions name a Rust source file or Cargo.toml; they do not use Python definition selectors. Inspect any rule and its effective settings with:

Rule options

Adjust a rule under the target’s standard rule_options table:
The adjustable structural budgets retain these defaults: 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 normal tooling paths to identify tooling crates:
Tooling paths receive the tooling-layout rules. 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:
Empty crate, domain, and role lists use automatic discovery. Configured paths must be canonical repository-relative POSIX paths within the target root. Intentional-layout paths skip aggregate layout checks for explicit subtrees while preserving per-file checks.

Cargo metadata and caching

Rust sources, Cargo manifests, an existing lockfile, and target configuration are cache inputs. Fensu uses locked dependency resolution when Cargo.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.