Sdlc/RequireInMethod crashes on require CONSTANT (NoMethodError in Call#library) #1044

Open
opened 2026-10-16 19:24:39 +00:00 by jared · 1 comment
Owner

Problem

Sdlc/RequireInMethod raises while inspecting a file that calls require with a constant argument. The cop assumes a string argument; a ConstNode has no value. The error hides real offenses.

Observed

Running cd plugins/os-sdlc && bundle exec rubocop --only Sdlc/RequireInMethod eval/ticket-takedown/lib/takedown/adapter/backlog_tracker.rb prints "An error occurred while Sdlc/RequireInMethod cop was inspecting ...". With -d: lib/os_sdlc/cops/require_in_method/call.rb:31:in 'Call#library': undefined method 'value' for an instance of RuboCop::AST::ConstNode (NoMethodError). Trigger: require LIB unless defined?(Backlog::Issues) inside load_backlog. Same crash at commit 3079f785. rubocop 1.90.0, ruby 4.0.2.

Reproduce

cd plugins/os-sdlc && bundle exec rubocop --only Sdlc/RequireInMethod eval/ticket-takedown/lib/takedown/adapter/backlog_tracker.rb

Acceptance criteria

  1. A cop test with require CONST inside a method runs without error; the cop reports an offense with a clear message or skips non-string arguments (owner decides); rubocop on backlog_tracker.rb reports no cop error.

Skeptic: VERDICT: CREATE — reproducible, and the pre-change file crashes the same way, so it is a defect in the cop.

Origin

  • Trigger: bundle exec rubocop --only Sdlc/RequireInMethod eval/ticket-takedown/lib/takedown/adapter/backlog_tracker.rb in plugins/os-sdlc, during the crc-refactor tuning run on plugins/os-backlog (branch crc-os-backlog-2026-10-16).
  • Improvised this session: none
  • Chain: NoMethodError in the cop ← Call#library assumes a string argument (plugins/os-sdlc/lib/os_sdlc/cops/require_in_method/call.rb:31) ← DESIGN
  • Root candidate: none beyond this ticket
  • Where: plugins/os-sdlc/lib/os_sdlc/cops/require_in_method/call.rb
  • Session: a5e278ab-89aa-4ed6-adb4-b70820788f0c
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-crc-os-backlog-2026-10-16/a5e278ab-89aa-4ed6-adb4-b70820788f0c.jsonl
## Problem `Sdlc/RequireInMethod` raises while inspecting a file that calls `require` with a constant argument. The cop assumes a string argument; a ConstNode has no `value`. The error hides real offenses. ## Observed Running `cd plugins/os-sdlc && bundle exec rubocop --only Sdlc/RequireInMethod eval/ticket-takedown/lib/takedown/adapter/backlog_tracker.rb` prints "An error occurred while Sdlc/RequireInMethod cop was inspecting ...". With -d: `lib/os_sdlc/cops/require_in_method/call.rb:31:in 'Call#library': undefined method 'value' for an instance of RuboCop::AST::ConstNode (NoMethodError)`. Trigger: `require LIB unless defined?(Backlog::Issues)` inside `load_backlog`. Same crash at commit 3079f785. rubocop 1.90.0, ruby 4.0.2. ## Reproduce ``` cd plugins/os-sdlc && bundle exec rubocop --only Sdlc/RequireInMethod eval/ticket-takedown/lib/takedown/adapter/backlog_tracker.rb ``` ## Acceptance criteria 1. A cop test with `require CONST` inside a method runs without error; the cop reports an offense with a clear message or skips non-string arguments (owner decides); rubocop on backlog_tracker.rb reports no cop error. Skeptic: VERDICT: CREATE — reproducible, and the pre-change file crashes the same way, so it is a defect in the cop. ## Origin - Trigger: `bundle exec rubocop --only Sdlc/RequireInMethod eval/ticket-takedown/lib/takedown/adapter/backlog_tracker.rb` in plugins/os-sdlc, during the crc-refactor tuning run on plugins/os-backlog (branch crc-os-backlog-2026-10-16). - Improvised this session: none - Chain: NoMethodError in the cop ← `Call#library` assumes a string argument (plugins/os-sdlc/lib/os_sdlc/cops/require_in_method/call.rb:31) ← DESIGN - Root candidate: none beyond this ticket - Where: plugins/os-sdlc/lib/os_sdlc/cops/require_in_method/call.rb - Session: a5e278ab-89aa-4ed6-adb4-b70820788f0c - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-crc-os-backlog-2026-10-16/a5e278ab-89aa-4ed6-adb4-b70820788f0c.jsonl
Author
Owner

Mechanism: a custom Sdlc cop assumes a node shape and raises, hiding other offenses in the file. Related, not folded: #1102 (BooleanControlParameter and ParameterThreadedThroughPrivateMethods crash on destructured parameters).

Mechanism: a custom Sdlc cop assumes a node shape and raises, hiding other offenses in the file. Related, not folded: #1102 (BooleanControlParameter and ParameterThreadedThroughPrivateMethods crash on destructured parameters).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#1044
No description provided.