1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# ============================================================================
# LINT POLICY FILE -- DO NOT WEAKEN, DISABLE, OR RELAX RULES WITHOUT EXPLICIT
# USER/MAINTAINER DIRECTION. REFACTOR THE CODE INSTEAD. "BEING LAZY TO
# REFACTOR" IS NOT A VALID REASON TO CHANGE LINTING BEHAVIOR. THE ONLY
# EXCEPTION IS DOCUMENTED AUTOGENERATED CODE HANDLED BY THE REPOSITORY'S
# APPROVED MECHANISM.
# ============================================================================
#
# Each section below maps to documentation in docs/code-style/* that explains
# WHY the rule exists and HOW to refactor code to comply. Reference these
# guides when fixing lint violations:
#
# - docs/code-style/boundaries.md # IO, prints, env vars, process spawning
# - docs/code-style/functional-transformations.md # Pure functions, no mutation
# - docs/code-style/coding-patterns.md # Iterator pipelines, refactor patterns
# - docs/code-style/architecture.md # Reader/Writer/Except patterns
# - docs/code-style/testing.md # Test strictness rules
# ============================================================================
# Package-local clippy configuration for ralph-workflow.
# --- Test strictness: no escape hatches ---
# See: docs/code-style/testing.md
#
# WHY: Tests should verify behavior, not contain implementation shortcuts that hide bugs.
# Using unwrap/expect/panic in tests masks failures and gives false confidence.
#
# HOW TO FIX:
# - Use `?` operator for Result/Option propagation
# - Use `match` or `if let` for explicit control flow
# - Use `unwrap_or`, `unwrap_or_else`, or `unwrap_or_default` with meaningful fallbacks
= false
= false
= false
= false
= false
# --- Iterator loops ---
# See: docs/code-style/coding-patterns.md ("Iterator transformation patterns")
#
# WHY: Reborrowing in iterator loops can cause ownership issues and unexpected behavior.
#
# HOW TO FIX:
# - Use `.iter()` instead of borrowing the iterator directly
= true
# --- Arithmetic ---
# See: docs/code-style/functional-transformations.md
#
# WHY: Arithmetic operations can panic on overflow in debug mode. Allowing safe operations
# enables pure functional code to use math without Result wrappers.
#
# HOW TO FIX:
# - Use checked arithmetic (e.g., `checked_add`) when overflow is possible
# - For known-safe operations, the allowed list suffices
= ["*", "+", "-", "/", "%", "+=", "-=", "*=", "/=", "-"]
# --- Disallowed types (interior mutability / shared mutable state) ---
# NOTE: Enforced by dylint's forbid_interior_mutability lint, which correctly distinguishes
# domain code from boundary modules. Clippy's blanket rules are too broad.
# See: docs/tooling/dylint.md
= []
# --- Disallowed methods (mutation / imperative patterns) ---
# NOTE: Enforced by dylint's forbid_mutating_receiver_methods lint, which correctly distinguishes
# domain code from boundary modules. Clippy's blanket rules are too broad.
# See: docs/tooling/dylint.md
= []
# --- Disallowed macros (side effects) ---
# NOTE: Terminal output (println/eprintln) is appropriate in boundary modules (io/, runtime/).
# dylint enforces the domain/boundary distinction correctly.
= [
{ = "std::dbg", = "No debug leftovers" },
]
# --- large_stack_frames: deliberate test-only code allowances via #[expect] ---
# The test harness generates large stack frames that are unavoidable.
# These are suppressed with #[expect(clippy::large_stack_frames, reason = "...")] at item scope.
# The generated lib-test harness error is also filtered by the xtask verify strip step.
# This is a deliberate exception documented in the lint policy.
# See: CODE_STYLE.md and the lint policy exception table.