Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Problem due to commit 75d15117643d17a3c3d92b41512bd7840c91705b included with 6.12.0

未关闭
#1,394 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
ruby
领域
documentation

调研方向

从 doc/api/ruby/create_ruby_doc.rb 开始,尤其关注 C_Parser_Paludis#initialize,并检查 rdoc/parser.rb 中的 parser 构造路径。比较 commit 75d15117643d17a3c3d92b41512bd7840c91705b 前后的 initializer 契约,然后验证一种无需 RDoc >= 6.12 即可工作的兼容方案。当文档化的 Ruby binding 生成流程在受影响的 RDoc 版本中不再引发参数数量错误时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

First of all, I should add that this is not really a bug, more of an uncomfortable compatibility problem, but README encourages me to report anything I have a problem with (nice, thanks!), so here's the problem:

I have a project which inherits from RDoc::Parser::C to generate documention for its ruby bindings.

module RDoc

    class C_Parser_Paludis < Parser::C
        #override C_Parse
        parse_files_matching(/\.(c|cc|cpp|CC)$/)

        def initialize(top_level, file_name, body, options, stats)
            ...
            super(top_level, file_name, new_body, options, stats)
        end
    ...
    end
end
begin
    r = RDoc::RDoc.new
    r.document(ARGV)
rescue RDoc::Error => e
    $stderr.puts e.message
    exit(1)
end

(Full code here: https://gitlab.exherbo.org/paludis/paludis/-/blob/master/doc/api/ruby/create_ruby_doc.rb)

After updating ruby 3.4.4 to 3.4.5, which updated rdoc from 6.10.0 to 6.14.0 I get:

RDoc is not a full Ruby parser and will fail when fed invalid ruby programs.

The internal error was:

        (ArgumentError) wrong number of arguments (given 4, expected 5)

/home/heiko/Quelltexte/git-sources/exherbo/paludis/doc/api/ruby/create_ruby_doc.rb:13:in 'initialize': wrong number of arguments (given 4, expected 5) (ArgumentError)
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/parser.rb:194:in 'Class#new'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/parser.rb:194:in 'RDoc::Parser.for'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:350:in 'RDoc::RDoc#parse_file'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:406:in 'block in RDoc::RDoc#parse_files'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:404:in 'Array#map'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:404:in 'RDoc::RDoc#parse_files'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:467:in 'RDoc::RDoc#document'
        from /home/heiko/Quelltexte/git-sources/exherbo/paludis/doc/api/ruby/create_ruby_doc.rb:87:in '<main>'

This is "caused" by 75d15117643d17a3c3d92b41512bd7840c91705b, which changed initialize's signature. I could conditionalize the call to super(..), but I don't know how to do that for C_Parser_Paludis's initialize itself.

Any pointers how this could be best solved without requiring rdoc >= 6.12.0 would be very welcome.

主要语言
Ruby
星标
927
派生
467
平均合并
23 小时 47 分钟
30 天内合并 PR
12

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby/rdoc 的其他 Issue

查看 ruby/rdoc 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。