Sdlc/Structural/RequireRelativeDensity: count only project-local requires #1385

Open
opened 2026-10-25 21:23:53 +00:00 by jared · 0 comments
Owner

Problem

Sdlc/Structural/RequireRelativeDensity counts gem require calls toward Max (15). Its fix is to replace the manual load list with Zeitwerk. Zeitwerk keeps gem requires, so a file over Max because of gem requires still offends after the fix.

Found by the #1325 zero-false-positive audit (docs/plans/class-length-family/sdlc-cop-audit.md).

Observed

The lesson names the false positives: mostly-gem require lists and intentional manifests such as a test helper (lint-lessons/sdlc-structural-require-relative-density.yml:18-19). The real hit plugins/cc-architect/scripts/plugin_config/plugin_config.rb:4 is a true hit.

Reproduce

n/a: a file with 16 top-level gem require lines offends and has no Zeitwerk fix.

Approach

Fix by shape. Put the change in the cop matcher, never in a config Exclude list.

Required work:

  1. Count require_relative, plus require of paths inside the project. Do not count gem requires.
  2. After the change, remove the lesson's "report it to the human" false-positive clause.

Acceptance criteria

  1. Given a file with 16 top-level gem require calls and no require_relative, when the cop runs, then it reports no offense.
  2. Given a file with 16 top-level require_relative calls, when the cop runs, then it reports an offense.

Origin

  • Trigger: the #1325 zero-false-positive audit of the Sdlc cops (docs/plans/class-length-family/sdlc-cop-audit.md)
  • Improvised this session: none
  • Chain: false positive ← matcher counts gem requires ← DESIGN (plugins/os-sdlc/lib/os_sdlc/cops/require_relative_density/node_candidate.rb:14-24)
  • Root candidate: none found; searched RequireRelativeDensity, require_relative_density, relative-density, require_relative
  • Where: plugins/os-sdlc/lib/os_sdlc/cops/require_relative_density.rb
  • Session: eb98cdcd-6783-46a0-b7df-cf18a8fe2a56
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-ticket-1325/eb98cdcd-6783-46a0-b7df-cf18a8fe2a56.jsonl

VERDICT: CREATE

## Problem `Sdlc/Structural/RequireRelativeDensity` counts gem `require` calls toward Max (15). Its fix is to replace the manual load list with Zeitwerk. Zeitwerk keeps gem requires, so a file over Max because of gem requires still offends after the fix. Found by the #1325 zero-false-positive audit (docs/plans/class-length-family/sdlc-cop-audit.md). ## Observed The lesson names the false positives: mostly-gem require lists and intentional manifests such as a test helper (lint-lessons/sdlc-structural-require-relative-density.yml:18-19). The real hit `plugins/cc-architect/scripts/plugin_config/plugin_config.rb:4` is a true hit. ## Reproduce n/a: a file with 16 top-level gem `require` lines offends and has no Zeitwerk fix. ## Approach Fix by shape. Put the change in the cop matcher, never in a config Exclude list. Required work: 1. Count `require_relative`, plus `require` of paths inside the project. Do not count gem requires. 2. After the change, remove the lesson's "report it to the human" false-positive clause. ## Acceptance criteria 1. Given a file with 16 top-level gem `require` calls and no `require_relative`, when the cop runs, then it reports no offense. 2. Given a file with 16 top-level `require_relative` calls, when the cop runs, then it reports an offense. ## Origin - Trigger: the #1325 zero-false-positive audit of the Sdlc cops (docs/plans/class-length-family/sdlc-cop-audit.md) - Improvised this session: none - Chain: false positive ← matcher counts gem requires ← DESIGN (plugins/os-sdlc/lib/os_sdlc/cops/require_relative_density/node_candidate.rb:14-24) - Root candidate: none found; searched RequireRelativeDensity, require_relative_density, relative-density, require_relative - Where: plugins/os-sdlc/lib/os_sdlc/cops/require_relative_density.rb - Session: eb98cdcd-6783-46a0-b7df-cf18a8fe2a56 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os--claude-worktrees-ticket-1325/eb98cdcd-6783-46a0-b7df-cf18a8fe2a56.jsonl VERDICT: CREATE
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#1385
No description provided.