Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Enforce workspace Clippy standards and document lint policy

Dylan M. Taylorb0d8ae7f8928
diff --git a/CLAUDE.md b/CLAUDE.md
index e8c455b0a..bed556afb 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -16,7 +16,7 @@ People trust DesignCraft with their layouts; a crash loses their work. **This ou
- **Bound recursion** (seen-sets or depth limits for nested or cyclic documents). **Locks:** `lock().unwrap_or_else(PoisonError::into_inner)` or an error; thread joins are `Result`s.
- **Last-resort guard:** escaped panics during command execution and file import/export become an error, never a lost document. It's a safety net, not a licence.
- **Prove it:** every crash fix lands with a small synthetic regression test that panicked before the fix.
-- Clean crates carry `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]`; new crates start with it. Tests may `unwrap` (`clippy.toml`).
+- Clean crates carry `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]`; new production crate roots must include the attribute before modules or other crate items, with crate-level `//!` documentation allowed before it. Every new workspace crate must also include `[lints] workspace = true` in `Cargo.toml` to inherit `[workspace.lints]`. Tests may `unwrap` (`clippy.toml`).
## Non-negotiables
- **Clean-room.** InDesign is installed on the dev machine and may be *observed* black-box: run it, use its UI with synthetic documents, take screenshots (by window id) stored only under `plan/indesign/screenshots/` (never committed). Never read, disassemble or copy anything inside the InDesign bundle (names/listings only), never copy Adobe icons, artwork, presets or wording beyond feature names, never commit files produced by InDesign. Never copy GPL/AGPL/LGPL code (Scribus, LibreOffice, Ghostscript…).
diff --git a/Cargo.toml b/Cargo.toml
index 0afeca737..fa4b839de 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -107,9 +107,11 @@ arboard = { version = "3.6", default-features = false }
unsafe_code = "forbid"
[workspace.lints.clippy]
+cognitive_complexity = "deny"
+too_many_arguments = "deny"
+wildcard_imports = "deny"
dbg_macro = "warn"
todo = "warn"
-too_many_arguments = "allow"
type_complexity = "allow"
# Line tables keep file and line in panics and backtraces; full debug info
diff --git a/clippy.toml b/clippy.toml
index 287e14edc..3522a15b6 100644
--- a/clippy.toml
+++ b/clippy.toml
@@ -5,3 +5,4 @@ allow-indexing-slicing-in-tests = true
disallowed-types = [
{ path = "egui::ComboBox", reason = "use craft_ui::ComboBox: egui's combo box menu can't grow back while open (egui#5225)" },
]
+cognitive-complexity-threshold = 30
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml
index df7dfa877..6d935ae8f 100644
--- a/xtask/Cargo.toml
+++ b/xtask/Cargo.toml
@@ -5,5 +5,8 @@ edition.workspace = true
license.workspace = true
publish = false
+[lints]
+workspace = true
+
[dependencies]
serde_json = { workspace = true }