fleetlint Policy for a fleet of repositories
v0.4
Getting started

lint/strict/rust

clippy reports unwraps, panics and debug macros

Implements lint/strict for rust.

Severitywarning
Tiers1, 2
Stacksrust
Scopeeach
Kindexpr
Sourcelibrary v0.1.0
Selected byfleetlint-recommended@v0.1.0

Requirement

The [lints.clippy] table (or [workspace.lints.clippy], also when inherited with [lints] workspace = true) sets every lint in params.required to warn, deny or forbid.

Why

These lints are off by default, and they are the ones that find the crashes a Rust program can still have.

Applies when

[toml("Cargo.toml")].exists(c, c != null && (has(c.lints) || (has(c.workspace) && has(c.workspace.lints))))

Check

For each item in:

params.required
[toml("Cargo.toml")].exists(c,
  ([has(c.lints) && has(c.lints.clippy) ? c.lints.clippy : dyn({})]
    + [has(c.workspace) && has(c.workspace.lints) && has(c.workspace.lints.clippy) ? c.workspace.lints.clippy : dyn({})]
    + (has(c.lints) && has(c.lints.workspace) && c.lints.workspace == true
      ? ["../", "../../", "../../../"].filter(d, file(d + "Cargo.toml")).map(d, toml(d + "Cargo.toml"))
          .filter(w, w != null && has(w.workspace) && has(w.workspace.lints) && has(w.workspace.lints.clippy))
          .map(w, w.workspace.lints.clippy)
      : []))
  .exists(t, item in t
    && (type(t[item]) == string ? t[item] : ("level" in t[item] ? t[item].level : "")) in ["warn", "deny", "forbid"]))

Parameters

  • required: [unwrap_used expect_used panic todo dbg_macro]

Fix

Add the missing lints to [lints.clippy] with level deny.

Agent instruction: Add each reported lint to [lints.clippy] as “deny”; where an unwrap is a proven invariant, replace it with expect and an INVARIANT comment instead of allowing the lint.

See: https://fleetlint.org/baseline/#static-analysis, https://fleetlint.org/stacks/#rust


Generated by fleetlint docs from catalog v0.1.0.