From dd5909289116b744d266ea70eb3232642d16d237 Mon Sep 17 00:00:00 2001 From: tomoya ishida Date: Sat, 14 Feb 2026 22:49:19 +0900 Subject: [PATCH 1/6] rubocop --autocorrect (#1611) Apply autocorrect with the latest rubocop. Old rubocop missed some "Style/MethodDefParentheses" offences that has splat or kwarg splat. The following code didn't get `Style/MethodDefParentheses` offences in `rubocop <= 1.84.1`, fixed in `v1.84.2` ```ruby def f a, b:, **c, &d end def g a, *b, c, d:, &e end ``` --- lib/rdoc/generator/darkfish.rb | 2 +- lib/rdoc/generator/json_index.rb | 2 +- lib/rdoc/markup/document.rb | 4 ++-- lib/rdoc/markup/formatter.rb | 2 +- lib/rdoc/markup/indented_paragraph.rb | 2 +- lib/rdoc/markup/list.rb | 4 ++-- lib/rdoc/markup/list_item.rb | 4 ++-- lib/rdoc/markup/verbatim.rb | 2 +- lib/rdoc/ri/paths.rb | 2 +- lib/rdoc/servlet.rb | 2 +- test/rdoc/support/test_case.rb | 14 +++++++------- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb index b31c1e4b7d..9a81b74688 100644 --- a/lib/rdoc/generator/darkfish.rb +++ b/lib/rdoc/generator/darkfish.rb @@ -173,7 +173,7 @@ def initialize(store, options) ## # Output progress information if debugging is enabled - def debug_msg *msg + def debug_msg(*msg) return unless $DEBUG_RDOC $stderr.puts(*msg) end diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb index 065caa47ea..c61391d630 100644 --- a/lib/rdoc/generator/json_index.rb +++ b/lib/rdoc/generator/json_index.rb @@ -118,7 +118,7 @@ def build_index ## # Output progress information if debugging is enabled - def debug_msg *msg + def debug_msg(*msg) return unless $DEBUG_RDOC $stderr.puts(*msg) end diff --git a/lib/rdoc/markup/document.rb b/lib/rdoc/markup/document.rb index 399cfe8e3e..d713160ad8 100644 --- a/lib/rdoc/markup/document.rb +++ b/lib/rdoc/markup/document.rb @@ -26,7 +26,7 @@ class RDoc::Markup::Document ## # Creates a new Document with +parts+ - def initialize *parts + def initialize(*parts) @parts = [] @parts.concat parts @@ -148,7 +148,7 @@ def pretty_print(q) # :nodoc: ## # Appends +parts+ to the document - def push *parts + def push(*parts) self.parts.concat parts end diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb index 8c55a37b06..e7f23eab98 100644 --- a/lib/rdoc/markup/formatter.rb +++ b/lib/rdoc/markup/formatter.rb @@ -185,7 +185,7 @@ def convert_string(string) # # alias accept_raw ignore - def ignore *node + def ignore(*node) end ## diff --git a/lib/rdoc/markup/indented_paragraph.rb b/lib/rdoc/markup/indented_paragraph.rb index c218501ce6..95995cf286 100644 --- a/lib/rdoc/markup/indented_paragraph.rb +++ b/lib/rdoc/markup/indented_paragraph.rb @@ -13,7 +13,7 @@ class RDoc::Markup::IndentedParagraph < RDoc::Markup::Raw # Creates a new IndentedParagraph containing +parts+ indented with +indent+ # spaces - def initialize indent, *parts + def initialize(indent, *parts) @indent = indent super(*parts) diff --git a/lib/rdoc/markup/list.rb b/lib/rdoc/markup/list.rb index 4a1066f2d6..9196904d5e 100644 --- a/lib/rdoc/markup/list.rb +++ b/lib/rdoc/markup/list.rb @@ -37,7 +37,7 @@ class RDoc::Markup::List # Creates a new list of +type+ with +items+. Valid list types are: # +:BULLET+, +:LABEL+, +:LALPHA+, +:NOTE+, +:NUMBER+, +:UALPHA+ - def initialize type = nil, *items + def initialize(type = nil, *items) @type = type @items = [] @items.concat items @@ -94,7 +94,7 @@ def pretty_print(q) # :nodoc: ## # Appends +items+ to the list - def push *items + def push(*items) @items.concat items end diff --git a/lib/rdoc/markup/list_item.rb b/lib/rdoc/markup/list_item.rb index 68193e0de5..54a52f7a5e 100644 --- a/lib/rdoc/markup/list_item.rb +++ b/lib/rdoc/markup/list_item.rb @@ -24,7 +24,7 @@ class RDoc::Markup::ListItem ## # Creates a new ListItem with an optional +label+ containing +parts+ - def initialize label = nil, *parts + def initialize(label = nil, *parts) @label = label @parts = [] @parts.concat parts @@ -92,7 +92,7 @@ def pretty_print(q) # :nodoc: ## # Adds +parts+ to the ListItem - def push *parts + def push(*parts) @parts.concat parts end diff --git a/lib/rdoc/markup/verbatim.rb b/lib/rdoc/markup/verbatim.rb index 606276dcf0..8fcf69fa34 100644 --- a/lib/rdoc/markup/verbatim.rb +++ b/lib/rdoc/markup/verbatim.rb @@ -9,7 +9,7 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw attr_accessor :format - def initialize *parts # :nodoc: + def initialize(*parts) # :nodoc: super @format = nil diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb index 8d33c5b7e5..266f342b0d 100644 --- a/lib/rdoc/ri/paths.rb +++ b/lib/rdoc/ri/paths.rb @@ -30,7 +30,7 @@ module RDoc::RI::Paths # :extra:: ri data directory from the command line. Yielded for each # entry in +extra_dirs+ - def self.each system = true, site = true, home = true, gems = :latest, *extra_dirs # :yields: directory, type + def self.each(system = true, site = true, home = true, gems = :latest, *extra_dirs) # :yields: directory, type return enum_for __method__, system, site, home, gems, *extra_dirs unless block_given? diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index fbb5bb0258..257e32cead 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -50,7 +50,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet # Creates an instance of this servlet that shares cached data between # requests. - def self.get_instance server, *options # :nodoc: + def self.get_instance(server, *options) # :nodoc: stores = @server_stores[server] new server, stores, @cache, *options diff --git a/test/rdoc/support/test_case.rb b/test/rdoc/support/test_case.rb index cb1a3bddd9..99af043991 100644 --- a/test/rdoc/support/test_case.rb +++ b/test/rdoc/support/test_case.rb @@ -103,7 +103,7 @@ def blank_line ## # Shortcut for RDoc::Markup::BlockQuote.new with +contents+ - def block *contents + def block(*contents) @RM::BlockQuote.new(*contents) end @@ -119,7 +119,7 @@ def comment(text, top_level = @top_level, language = nil) ## # Shortcut for RDoc::Markup::Document.new with +contents+ - def doc *contents + def doc(*contents) @RM::Document.new(*contents) end @@ -140,14 +140,14 @@ def head(level, text) ## # Shortcut for RDoc::Markup::ListItem.new with +label+ and +parts+ - def item label = nil, *parts + def item(label = nil, *parts) @RM::ListItem.new label, *parts end ## # Shortcut for RDoc::Markup::List.new with +type+ and +items+ - def list type = nil, *items + def list(type = nil, *items) @RM::List.new type, *items end @@ -163,7 +163,7 @@ def mu_pp(obj) # :nodoc: ## # Shortcut for RDoc::Markup::Paragraph.new with +contents+ - def para *a + def para(*a) @RM::Paragraph.new(*a) end @@ -177,7 +177,7 @@ def rule(weight) ## # Shortcut for RDoc::Markup::Raw.new with +contents+ - def raw *contents + def raw(*contents) @RM::Raw.new(*contents) end @@ -198,7 +198,7 @@ def temp_dir ## # Shortcut for RDoc::Markup::Verbatim.new with +parts+ - def verb *parts + def verb(*parts) @RM::Verbatim.new(*parts) end From 6f4a082b7ba729a3a0078fd814a299814876d91b Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Mon, 11 May 2026 21:09:14 -0700 Subject: [PATCH 2/6] Bump ruby/setup-ruby to v1.307.0 for Ruby 4.0 Windows support v1.275.0 doesn't list 4.0 as an available Ruby version on windows-latest, which makes the test (4.0, windows-latest) job fail at 'Set up Ruby' on the ruby-4.0 release branch. --- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 501ddc49ab..7df77092e6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,7 +21,7 @@ jobs: - if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt install libyaml-dev - name: Set up Ruby - uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0 + uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: 3.3 bundler-cache: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4dabb4ed5..3149d6e921 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: - if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt install libyaml-dev - name: Set up Ruby - uses: ruby/setup-ruby@d354de180d0c9e813cfddfcbdc079945d4be589b # v1.275.0 + uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true # 'bundle install' and cache From bdbb51e2f0dbf8e89df30986f214a82368cd7aff Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sat, 14 Mar 2026 15:44:03 +0000 Subject: [PATCH 3/6] Fix herb linter offenses in ERB templates (#1645) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove `then` keyword from all ERB control flow tags (52 offenses) - Move duplicated HTML elements outside conditional branches (14 offenses) - Add `.herb.yml` config to disable rules not applicable to RDoc: - `erb-no-instance-variables-in-partials` — RDoc templates aren't Rails partials - `erb-no-unsafe-script-interpolation` — templates render trusted RDoc data - `erb-no-output-in-attribute-position` — same reason Fixes CI failure caused by `@herb-tools/linter` 0.9.0 introducing new rules. --- .herb.yml | 21 ++++++++++++ lib/rdoc/generator/template/aliki/_head.rhtml | 2 +- .../template/aliki/_sidebar_extends.rhtml | 14 ++++---- .../template/aliki/_sidebar_includes.rhtml | 14 ++++---- .../template/aliki/_sidebar_installed.rhtml | 2 +- .../template/aliki/_sidebar_pages.rhtml | 2 +- .../template/aliki/_sidebar_sections.rhtml | 2 +- lib/rdoc/generator/template/aliki/class.rhtml | 34 +++++++++---------- .../template/aliki/servlet_root.rhtml | 2 +- .../template/darkfish/_sidebar_extends.rhtml | 14 ++++---- .../template/darkfish/_sidebar_includes.rhtml | 14 ++++---- .../darkfish/_sidebar_installed.rhtml | 2 +- .../template/darkfish/_sidebar_pages.rhtml | 2 +- .../template/darkfish/_sidebar_sections.rhtml | 2 +- .../darkfish/_sidebar_table_of_contents.rhtml | 10 +++--- .../generator/template/darkfish/class.rhtml | 34 +++++++++---------- .../template/darkfish/table_of_contents.rhtml | 6 ++-- 17 files changed, 103 insertions(+), 74 deletions(-) create mode 100644 .herb.yml diff --git a/.herb.yml b/.herb.yml new file mode 100644 index 0000000000..398bee965d --- /dev/null +++ b/.herb.yml @@ -0,0 +1,21 @@ +version: 0.9.0 + +linter: + enabled: true + + rules: + # RDoc templates are not Rails partials — instance variables are the + # standard way to pass data from the generator to templates. + erb-no-instance-variables-in-partials: + enabled: false + + # Template output is generated from trusted RDoc data, not user input. + erb-no-unsafe-script-interpolation: + enabled: false + + # Same: attribute values come from trusted RDoc data. + erb-no-output-in-attribute-position: + enabled: false + +formatter: + enabled: false diff --git a/lib/rdoc/generator/template/aliki/_head.rhtml b/lib/rdoc/generator/template/aliki/_head.rhtml index 1733bd0174..d855e49081 100644 --- a/lib/rdoc/generator/template/aliki/_head.rhtml +++ b/lib/rdoc/generator/template/aliki/_head.rhtml @@ -28,7 +28,7 @@ <%- elsif @title %> <%- if @options.main_page and - main_page = @files.find { |f| f.full_name == @options.main_page } then %> + main_page = @files.find { |f| f.full_name == @options.main_page } %> " diff --git a/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml b/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml index 1544b83778..a6086639e6 100644 --- a/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +++ b/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml @@ -1,4 +1,4 @@ -<%- unless klass.extends.empty? then %> +<%- unless klass.extends.empty? %>