Skip to content

chore: god-level clippy — adopt nexus elite lint config #61

Description

@joeldsouzax

Adopt nexus's elite ("god-level") clippy config verbatim so Bombay holds the same hygiene bar as nexus/agency. It is two cooperating files: clippy.toml (thresholds + banned methods/types) and [workspace.lints.clippy] in the root Cargo.toml (the 5-group ruthless block). Every member crate opts in with [lints] workspace = true.

clippy.toml (Bombay)

# Bombay — Elite Clippy Configuration (from nexus)
allow-unwrap-in-tests = true
allow-expect-in-tests = true

# 1. BRAIN-CAPACITY LIMITS
cognitive-complexity-threshold = 9
too-many-arguments-threshold = 5
too-many-lines-threshold = 80

# 2. BAN DANGEROUS METHODS
[[disallowed-methods]]
path = "std::process::exit"
reason = "Return a `Result` or `ExitCode` from main instead."

[[disallowed-methods]]
path = "std::thread::spawn"
reason = "Use `std::thread::scope` or an async runtime like Tokio."

# 3. BAN DANGEROUS TYPES
[[disallowed-types]]
path = "std::sync::Mutex"
reason = "Use `tokio::sync::Mutex` or `parking_lot::Mutex`."

[[disallowed-types]]
path = "std::sync::RwLock"
reason = "Use `tokio::sync::RwLock` or `parking_lot::RwLock`."

Root Cargo.toml

[workspace.lints.clippy]
# 1. THE FOUNDATION
all      = { level = "deny", priority = -1 }
pedantic = { level = "deny", priority = -1 }
nursery  = { level = "deny", priority = -1 }

# 2. THE RUTHLESS RESTRICTIONS
unwrap_used        = "deny"
expect_used        = "deny"
panic              = "deny"
todo               = "deny"
unimplemented      = "deny"
dbg_macro          = "deny"
print_stdout       = "deny"
print_stderr       = "deny"
disallowed_methods = "deny"
disallowed_types   = "deny"

# 3. MEMORY & PERFORMANCE STRICTNESS
clone_on_ref_ptr = "deny"
as_conversions   = "deny"
str_to_string    = "deny"
implicit_clone   = "deny"

# 4. VARIABLE HYGIENE
shadow_reuse     = "deny"
shadow_same      = "deny"
shadow_unrelated = "deny"

# 5. THE "NO CHEATING" RULE
allow_attributes_without_reason = "deny"

Every member crate

[lints]
workspace = true

Optional: also adopt agency's [workspace.lints.rust]

nexus ships clippy-only; agency additionally denies rust lints. Recommended for Bombay too, but unsafe_code is the catch (see below):

[workspace.lints.rust]
unsafe_code     = "deny"   # see phasing note — kameo uses unsafe transmute
missing_docs    = "warn"
unreachable_pub = "deny"
dead_code       = "deny"

CRITICAL: phasing (do NOT apply atomically to the fork)

Forked kameo will fail thousands of these immediately. Concretely:

Phasing plan:

  1. Land clippy.toml + [workspace.lints.clippy] with the foundation groups at warn first (all/pedantic/nursery = warn), get a baseline count.
  2. Flip the ruthless restrictions (unwrap/expect/panic/dbg) to deny as the code is cleaned crate-by-crate.
  3. Flip all/pedantic/nursery to deny last, once the fork compiles clean.
  4. Track allow-with-reason exceptions; allow_attributes_without_reason = deny forces every #[allow] to justify itself.

Cross-links

Acceptance

clippy.toml + [workspace.lints.clippy] (+ optional rust lints) checked in; every crate has [lints] workspace = true; nix flake check clippy step is green at the current phase; no blanket #[allow] without a reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions