Extract a shared ClassSiteCop base for the two ClassSite-driven cops #659
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
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
rule-proposal
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#659
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?
Problem
lib/os_sdlc/cops/instance_variable_assumption.rb:18 and lib/os_sdlc/cops/primitive_obsessed_ivar.rb:18 contain byte-identical code defining on_class and Offense struct. Each cop defines its own nested ClassSite class; the only difference is which ClassSite constant resolves. flay reports IDENTICAL, mass*2 = 64.
Reproduce
n/a: refactor ticket, no runtime defect
Approach
Add lib/os_sdlc/cops/class_site_cop.rb, a base class inheriting from the same RuboCop base the two cops use today. It holds the Offense struct and on_class, resolving
self.class::ClassSite. Both cops inherit from it and keep only their ClassSite.Required work:
Acceptance criteria
Owner sketch
OsSdlc::Cops::ClassSiteCopinlib/os_sdlc/cops/class_site_cop.rbowns the offense loop and theOffensestruct.InstanceVariableAssumptionandPrimitiveObsessedIvarinherit from it and keep only their nestedClassSite.Origin
Session: 24f1de09-c081-4958-902b-0512a5d86e04
Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/24f1de09-c081-4958-902b-0512a5d86e04.jsonl
Where: lib/os_sdlc/cops/
Source: flay duplication sweep (bin/dup-sweep) run 2026-09-23 on plugins/os-sdlc; lib+bin score 726.
Work started via /os-sdlc:implement on branch ticket-659 (session 24f1de09).
Resolution
Done: ClassSiteCop base extracted in RuboCop::Cop::Sdlc::Structural; both cops and their nested reopenings inherit it; duplicated on_class and Offense removed.
Evidence: Pipeline impl 3 on coding.yaml: programmer gate test+lint green, reviewer pass. flay lib+bin 726 -> 662; the pair no longer listed. Branch ticket-659.
Follow-ups: none
- [ ]but the template and Required-work parsers require numbered lines #664