lint rule: primitive-obsession on raw-hash ivar (reek DataClump approximation) #207
Labels
No labels
P0
P1
P2
P3
bug
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#207
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Migrated from jared/os-sdlc#33 (repo retired).
Problem
A primitive-typed ivar (e.g. a raw Hash) is touched by 3+ methods in a class, each re-encoding its own piece of a shared concept (e.g. validation, default-fill lookup, aggregation). Primitive obsession: no owning object for the concept.
Detection
Correction
Extract a value object wrapping the primitive, owning its access/validation/default behavior; the original class delegates to it.
Pass/fail examples
Provenance
Fable finding. Run 18 (ticket #18, decision-dice sandbox, now retired), dual review, 2026-07-21.
Implementation plan
NEEDS SCOPING before implementation: "3+ methods, each performing distinct operations" is a judgment call (what counts as "distinct"?) rather than a clean AST pattern -- this is closer to a reek smell than a rubocop-style structural cop. Needs a tighter, mechanically-checkable definition (e.g. threshold on method count referencing the ivar, regardless of operation distinctness) before it can be implemented as a deterministic cop.
Recommendation for maintainer: drop the "distinct operations" judgment call and use a pure reference-count threshold — flag any Hash/Array ivar referenced (read or write) from 3+ instance methods in a class, regardless of what each method does with it. This is mechanically AST-checkable (ivar node count grouped by enclosing def) and errs toward false positives over false negatives, acceptable for an advisory cop. This fully specifies the detection rule; no open maintainer decision remains.
Implemented via os-sdlc pipeline (APPROVE). Mechanical scoping per triage: Sdlc/Structural/PrimitiveObsessedIvar (Hash/Array literal in initialize + 3+ referencing methods). Merged to main in
e2960c3.