Skip to content

Remove dead constants and unused AnonClass#1642

Merged
tompng merged 1 commit intomasterfrom
remove-dead-constants
Mar 12, 2026
Merged

Remove dead constants and unused AnonClass#1642
tompng merged 1 commit intomasterfrom
remove-dead-constants

Conversation

@st0012
Copy link
Member

@st0012 st0012 commented Mar 12, 2026

Summary

  • Remove RDoc::AnonClass class and file (documented as "never used")
  • Remove Darkfish::VERSION (unreferenced)
  • Remove Formatter::InlineTag struct (unused after inline parser rewrite)
  • Remove ToHtmlCrossref::CLASS_REGEXP_STR and METHOD_REGEXP_STR (aliased but unused within the file)

Process & tools used

  1. Detect candidates — Used detect_dead_constants from Rubydex to find constants with zero resolved references in lib/. Got 22 candidates.
  2. Filter out false positives — Grepped for actual usage of each candidate, catching private constants used internally, dynamic access via const_defined?/const_get, default parameters, and generated code (Racc).
  3. Remove confirmed dead code — Deleted 5 constants and 1 class+file.
  4. Run full test suite — Caught that one deletion (RI::Formatter) broke a require_relative in ri/driver.rb, so restored it. Final run: 2384 tests, 0 failures.

- `RDoc::AnonClass` — documented as "never used", no references
- `RDoc::Generator::Darkfish::VERSION` — never referenced
- `RDoc::Markup::Formatter::InlineTag` — never instantiated after inline parser rewrite
- `RDoc::Markup::ToHtmlCrossref::CLASS_REGEXP_STR` — aliased but unused
- `RDoc::Markup::ToHtmlCrossref::METHOD_REGEXP_STR` — aliased but unused
@matzbot
Copy link
Collaborator

matzbot commented Mar 12, 2026

🚀 Preview deployment available at: https://3e0e24bb.rdoc-6cd.pages.dev (commit: 2c8a3f1)

@st0012 st0012 marked this pull request as ready for review March 12, 2026 13:00
@tompng tompng merged commit 05ed61c into master Mar 12, 2026
78 checks passed
@tompng tompng deleted the remove-dead-constants branch March 12, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants