Project

General

Profile

Actions

Defect #39576

closed

`rake yard` does not work with Ruby >= 3.2

Added by Go MAEDA 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Gems support
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

`rake yard` which generates YARD documentation raises an exception and exits immediately after startup if the Ruby version is 3.2 or higher.

Please see error.txt.


Files

error.txt (5.95 KB) error.txt Go MAEDA, 2023-11-18 01:32

Related issues

Related to Redmine - Feature #38099: Add Ruby 3.2 supportClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA 5 months ago

  • Subject changed from `rake yard` does not work with Ruby > 3.2 to `rake yard` does not work with Ruby >= 3.2
Actions #2

Updated by Go MAEDA 5 months ago

  • Target version set to 5.1.1

The following change fixes the issue.

The cause of this issue is that the current code creates a nested array by adding another array as a single element using the << operator. The variable t.files expects a flat array, but the current implementation results in a nested array like ['app/**/*..rb', ["lib/generators/redmine_plugin/redmine_plugin_generator.rb", ...]].

Replacing << with += creates a flat array, aligning with the expected structure for t.files.

Index: lib/tasks/yardoc.rake
===================================================================
--- lib/tasks/yardoc.rake    (リビジョン 22450)
+++ lib/tasks/yardoc.rake    (作業コピー)
@@ -3,7 +3,7 @@

   YARD::Rake::YardocTask.new do |t|
     files = ['app/**/*.rb']
-    files << Dir['lib/**/*.rb', 'plugins/**/*.rb'].reject {|f| f.match(/test/) }
+    files += Dir['lib/**/*.rb', 'plugins/**/*.rb'].reject {|f| f.match(/test/)}
     t.files = files

     static_files = ['doc/CHANGELOG',
Actions #3

Updated by Go MAEDA 5 months ago

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA

Committed the patch in r22456.

Actions #4

Updated by Go MAEDA 5 months ago

  • Status changed from Resolved to Closed
  • Resolution set to Fixed
Actions #5

Updated by Go MAEDA 5 months ago

Actions

Also available in: Atom PDF