Skip to content

Commit 05ed61c

Browse files
authored
Remove dead constants and unused AnonClass (#1642)
## 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](https://github.com/Shopify/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.
1 parent 4a68130 commit 05ed61c

File tree

6 files changed

+0
-26
lines changed

6 files changed

+0
-26
lines changed

lib/rdoc.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ def self.home
189189
autoload :Context, "#{__dir__}/rdoc/code_object/context"
190190
autoload :TopLevel, "#{__dir__}/rdoc/code_object/top_level"
191191

192-
autoload :AnonClass, "#{__dir__}/rdoc/code_object/anon_class"
193192
autoload :ClassModule, "#{__dir__}/rdoc/code_object/class_module"
194193
autoload :NormalClass, "#{__dir__}/rdoc/code_object/normal_class"
195194
autoload :NormalModule, "#{__dir__}/rdoc/code_object/normal_module"

lib/rdoc/code_object.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# * RDoc::Context
1111
# * RDoc::TopLevel
1212
# * RDoc::ClassModule
13-
# * RDoc::AnonClass (never used so far)
1413
# * RDoc::NormalClass
1514
# * RDoc::NormalModule
1615
# * RDoc::SingleClass

lib/rdoc/code_object/anon_class.rb

Lines changed: 0 additions & 10 deletions
This file was deleted.

lib/rdoc/generator/darkfish.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ class RDoc::Generator::Darkfish
7373
css/rdoc.css
7474
]
7575

76-
##
77-
# Release Version
78-
79-
VERSION = '3'
80-
8176
##
8277
# Description of this generator
8378

lib/rdoc/markup/formatter.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@
1414

1515
class RDoc::Markup::Formatter
1616

17-
##
18-
# Tag for inline markup containing a +bit+ for the bitmask and the +on+ and
19-
# +off+ triggers.
20-
21-
InlineTag = Struct.new(:bit, :on, :off)
22-
23-
2417
##
2518
# Converts a target url to one that is relative to a given path
2619

lib/rdoc/markup/to_html_crossref.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
88

99
# :stopdoc:
1010
ALL_CROSSREF_REGEXP = RDoc::CrossReference::ALL_CROSSREF_REGEXP
11-
CLASS_REGEXP_STR = RDoc::CrossReference::CLASS_REGEXP_STR
1211
CROSSREF_REGEXP = RDoc::CrossReference::CROSSREF_REGEXP
13-
METHOD_REGEXP_STR = RDoc::CrossReference::METHOD_REGEXP_STR
1412
# :startdoc:
1513

1614
##

0 commit comments

Comments
 (0)