Skip to content

Built-in checks

This catalog is generated from CheckMeta in the cofferdam source — every check is guaranteed to be in sync with the running binary. The machine-readable index lives at checks.json and is consumed by AI agents.

Consistency

  • Consistency.BroadSuppression — Broad-form // cofferdam-ignore (no check id) silences every check on the next line. Tighten to a scoped form so suppression intent is auditable: // cofferdam-ignore: <CheckId>: <reason> (colon-separator) or // cofferdam-ignore <CheckId> — <reason> (space-separator, em-dash or hyphen reason).
  • Consistency.QuoteStyle — Mixed quote styles within a file hurt scanability. Use a consistent quote character (single or double) throughout.
  • Consistency.UnusedSuppression — A cofferdam-ignore directive (next-line, range, or file-wide) targets a check ID that has no current finding in scope. The underlying issue was likely fixed or the code was deleted — the directive is now dead weight.

Design

  • Design.BoundaryFrozen — File lives inside an architectural boundary marked frozen=true in cofferdam.invariants.toml. New code in this area should be reviewed against the boundary's stated reason.
  • Design.DuplicateExportName — The same name is exported from multiple files. Barrel re-exports collide silently and importers can't tell which one they got.
  • Design.ImportCycle — Files in this group import each other in a cycle. Cycles cause initialization-order surprises and obscure module boundaries.
  • Design.InvariantViolation — An import edge violates a [invariants] rule declared in cofferdam.invariants.toml.
  • Design.LayerViolation — An import crosses a declared architectural layer in a direction not permitted by [layers].allow.
  • Design.MaxParameters — Functions with too many parameters are hard to call correctly. Pass an options object instead.
  • Design.OrphanExport — An exported symbol is never imported anywhere in the project. Likely dead code left over from a refactor.
  • Design.ScriptedInvariant — A scripted invariant declared in cofferdam.invariants.toml under [invariants.scripted] is violated for this file.
  • Rust.MissingPubDoc — Public items in a library crate compose the published API surface. Document each pub fn / pub struct / pub enum / pub trait with a /// doc comment so consumers can understand what to call.

Readability

Refactor

  • Refactor.CognitiveComplexity — Sonar-style cognitive complexity. Branching breaks plus a nesting penalty — deeply nested code costs more than a long flat switch.
  • Refactor.CyclomaticComplexity — McCabe cyclomatic complexity counts independent paths through a function. High values indicate branching that's hard to test and reason about.
  • Refactor.DeadExport — Every importer of this export imports its local binding and never references it. The export is dead even though it appears used.
  • Refactor.DuplicateBlock — Runs of statements that recur (after rename canonicalisation) in multiple files. Likely copy-paste — extract a shared helper.
  • Refactor.LongAndComplex — Functions that are both long and complex are the strongest refactor candidates. Length alone catches flat config tables; complexity alone catches deeply-branching short helpers. The intersection is almost always a real refactor target.
  • Refactor.PreferNullishCoalescingx || default falls through on every falsy value (0, "", false). Use ?? to fall through only on null/undefined.
  • Refactor.PreferOptionalChaina && a.b && a.b.c is more concisely written as a?.b?.c. The optional-chain operator (?.) short-circuits on null/undefined.
  • Refactor.UnusedVariable — Variables declared but never read are dead code. Prefix with _ to opt out where the binding is intentionally unused (e.g., positional function parameters).

Warning

  • Rust.NoUnimplementedInNonTestunimplemented!() / todo!() panic at runtime; calling them outside test code ships a guaranteed crash. Implement the function or move it into a #[test].
  • Rust.NoUnwrapInLib — Calling .unwrap() in library code panics on None/Err(_) with no diagnostic context. Return Result and propagate via ?, or use .expect("<reason>") when the value is provably infallible.
  • Warning.NoConsoleLogconsole.log(...) calls are typically debugging leftovers. Route logs through a dedicated logger or strip them in CI.
  • Warning.NoDebuggerdebugger statements halt execution under attached devtools. Remove before shipping.
  • Warning.NoEvaleval(...) and new Function(...) execute arbitrary strings as code. Universally banned for security and performance reasons.
  • Warning.TripleEquals== and != perform type coercion and are almost always a bug. Use === and !== instead. · autofix
  • Warning.UnusedImport — Re-export of a symbol that no other file imports from this file. Single-file linters miss this case.
  • Warning.UnusedNullCheck — An equality check against null/undefined whose other operand's TypeScript type already excludes that value — the guard can never change the outcome. Dead defensive code, or a hint the type annotation disagrees with reality.

MIT License