Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDoc plugin output nothing with RDoc 6.5.0 #1331

Closed
ybiquitous opened this issue May 15, 2023 · 1 comment · Fixed by #1333
Closed

RDoc plugin output nothing with RDoc 6.5.0 #1331

ybiquitous opened this issue May 15, 2023 · 1 comment · Fixed by #1333
Labels
bug Something isn't working
Milestone

Comments

@ybiquitous
Copy link
Contributor

Hi. I find the RBS RDoc plugin outputs nothing with RDoc 6.5.0. Please look at the following sections for details.

Reproduction steps

  1. Save the following content in a file named test.rb:
#!/usr/bin/env ruby
require 'bundler/inline'

rdoc_version, = ARGV
abort "Usage: #{$0} <rdoc_version>" unless rdoc_version

gemfile(true) do
  source 'https://rubygems.org'
  gem 'rdoc', rdoc_version
  gem 'rbs', '3.1.0'
end

rbs_file = 'user.rbs'
File.write rbs_file, <<~RBS
class User
  def name: -> String
end
RBS

require 'rdoc/rdoc'
RDoc::RDoc.new.document [rbs_file]
  1. Run the following commands:
$ ./test.rb '>=6.5.0'
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using stringio 3.0.6
Using rbs 3.1.0
Using bundler 2.4.13
Using psych 5.1.0
Using rdoc 6.5.0
Parsing sources...
100% [ 1/ 1]  user.rbs

Generating Darkfish format into /Users/koba/tmp/rbs-rdoc/doc...

  Files:      1

  Classes:    0 (0 undocumented)
  Modules:    0 (0 undocumented)
  Constants:  0 (0 undocumented)
  Attributes: 0 (0 undocumented)
  Methods:    0 (0 undocumented)

  Total:      0 (0 undocumented)
    0.00% documented

  Elapsed: 0.1s
$ ./test.rb '<6.5.0'
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using bundler 2.4.13
Using rbs 3.1.0
Using stringio 3.0.6
Using psych 5.1.0
Using rdoc 6.4.0
Parsing sources...
100% [ 1/ 1]  user.rbs

Generating Darkfish format into /Users/masafumi.koba/tmp/rbs-rdoc/doc...

  Files:      1

  Classes:    1 (1 undocumented)
  Modules:    0 (0 undocumented)
  Constants:  0 (0 undocumented)
  Attributes: 0 (0 undocumented)
  Methods:    1 (1 undocumented)

  Total:      2 (2 undocumented)
    0.00% documented

  Elapsed: 0.1s

Using RDoc 6.5.0 ('>=6.5.0') outputs no classes, while using RDoc 6.4.0 (<6.5.0) outputs 1 class.

Suggestion

I think the cause is the following code:

gem 'rdoc', '~> 6.4.0'

This code can raise Gem::LoadError with the message:

Gem::LoadError: can't activate rdoc (~> 6.4.0), already activated rdoc-6.5.0. Make sure all dependencies are added to Gemfile.

Note that the message above is actually discarded here:

rbs/lib/rdoc/discover.rb

Lines 16 to 17 in 97187e9

rescue Gem::LoadError
# Error :sad:

So, I think we could fix the bug to allow newer RDoc versions like this:

-gem 'rdoc', '~> 6.4.0' 
+gem 'rdoc', '>= 6.4.0' 

But PR #1169 has pinned the RDoc version as 6.4.0 for some reason (I'm not sure why). 🤔

@soutaro soutaro added the bug Something isn't working label May 16, 2023
@soutaro soutaro added this to the RBS 3.1.x milestone May 16, 2023
@ybiquitous
Copy link
Contributor Author

Thank you for the quick fix! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants