Use inherited documentation when checking alias parameter coverage - #1780
Open
sjh9714 wants to merge 1 commit into
Open
Use inherited documentation when checking alias parameter coverage#1780sjh9714 wants to merge 1 commit into
sjh9714 wants to merge 1 commit into
Conversation
An alias has no comment of its own, so RDoc::Stats#undoc_params reported every parameter of an aliased method as undocumented even though RDoc::MethodAttr#documented? already resolves the inherited documentation. Fall back to the comment of #is_alias_for or #see when the method has none.
sjh9714
requested a deployment
to
fork-preview-protection
August 18, 2026 01:17 — with
GitHub Actions
Waiting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1567.
rdoc -C1lists the parameters of an aliased method as undocumented, eventhough the alias inherits the original method's documentation.
rdoc -Con thesame file already reports it as fully covered.
Given the file from the issue:
rdoc -C1reports:Methods: 3 (0 undocumented)is the tell: the aliases already count asdocumented, but their parameters do not.
RDoc::MethodAttr#documented?resolves inherited documentation through#is_alias_forand#see, whileRDoc::Stats#undoc_paramsparsesmethod.commentdirectly, which is empty for an alias, so every parameter comesback undocumented.
Changes
RDoc::Stats#undoc_paramsfalls back to the comment of#is_alias_foror#seewhen the method carries no comment of its own. A method with its owncomment is unaffected, so the only behavior change is for objects
#documented?already treats as documented.test_undoc_params_*cases.Testing
ruby -Ilib -Itest test/rdoc/rdoc_stats_test.rb -n /undoc_params/— the newtest fails without the fix (
<["a"]> was expected to be empty) and passeswith it.
rake normal_test— 2520 tests, 6165 assertions, 0 failures, 0 errors.bundle exec rubocop lib/rdoc/stats.rb test/rdoc/rdoc_stats_test.rb— nooffenses.
ruby -Ilib exe/rdoc -C1 --op /tmp/rdocout /tmp/rdoc_bug.rbon the file abovenow reports
Parameters: 6 (0 undocumented)and100.00% documented.