Project

General

Profile

Actions

Defect #14796

closed

Yard rake file is not updated for Redmine 2.x

Added by Mischa The Evil about 11 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

The YARD rake file is not yet updated to match the current (Redmine 2.x) locations of plugins, which causes two issues:
  1. yard is parsing test files of core plugins, while it shouldn't
  2. yard is not parsing regular files of third-party plugins, while it should

The first issue is being caused by source:/trunk/lib/tasks/yardoc.rake#L5 which adds lib/**/*.rb to files. After r9533 Rails plugins required by the core are located in lib/plugins instead of vendor/plugins, so they are now going to be parsed by yard already through source:/trunk/lib/tasks/yardoc.rake#L5, instead of being added through source:/trunk/lib/tasks/yardoc.rake#L6 which does have the exclusion regex for test files.

The second issue is being caused by source:/trunk/lib/tasks/yardoc.rake#L6 which is still expecting plugins to reside in vendor/plugins instead of plugins (pre r9503).

The following patch should fix both of the above mentioned issues:

Index: lib/tasks/yardoc.rake
===================================================================
--- lib/tasks/yardoc.rake    (revision 12119)
+++ lib/tasks/yardoc.rake    (working copy)
@@ -2,8 +2,10 @@
   require 'yard'

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

     static_files = ['doc/CHANGELOG',

Note: this patch will also make yard to exclude test files under other directories in lib besides lib/plugins, but:
  • quick-scan: there are none...
  • if there will be some it doesn't really matter in my opinion, because test files should not be parsed by yard in general (read: while being invoked using the rake file that is provided by Redmine)
Actions

Also available in: Atom PDF