Sdlc/Sequel/RowIndexOnModel: match receiver origin, not name regex or test-path globs #1383
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#1383
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
Sdlc/Sequel/RowIndexOnModelflagsx[:sym]by receiver name (row,record, ...). When the receiver is a Hash, the prescribed fixrow.numberraisesNoMethodError. The cop also skips test paths by glob (DEFAULT_ALLOWED_PATHS, row_index_on_model.rb:16) instead of by shape.Found by the #1325 zero-false-positive audit (docs/plans/class-length-family/sdlc-cop-audit.md).
Observed
Counterexample 1:
plugins/os-backlog/bin/wakeup-poll:37-38. Therowis a Hash, becauseopen_issuesreturns Hashes (plugins/os-backlog/lib/backlog/forgejo_backend.rb:38).Counterexample 2: a naked-dataset row is a Hash.
Reproduce
n/a: run
rubocop --only Sdlc/Sequel/RowIndexOnModelon the snippet above.Approach
Fix by shape. Put the carve-out in the cop matcher, never in a config Exclude list or a test-path exclusion.
Required work:
Model#...call. Do not match by name.DEFAULT_ALLOWED_PATHStest globs.Acceptance criteria
db[:handoffs].all.map { |row| row[:title] }, when the cop runs, then it reports no offense.Handoff.where(x: 1).map { |row| row[:title] }, when the cop runs, then it reports an offense.Origin
VERDICT: CREATE