Defect #14796

Yard rake file is not updated for Redmine 2.x

Added by Mischa The Evil over 4 years ago. Updated over 3 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Baptiste Barth% Done:

0%

Category:Code cleanup/refactoring
Target version:2.5.3
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)

Associated revisions

Revision 13365
Added by Jean-Baptiste Barth over 3 years ago

Update yard rake task for Redmine 2.x (#14796).

Contributed by Mischa The Evil.

History

#1 Updated by Mischa The Evil over 3 years ago

  • Assignee set to Jean-Baptiste Barth

@Jean-Baptiste:
Nice to see you are merging-in some patches ;) Can you maybe take a look at this patch also? It seems to me a small change, which doesn't break anything...
Thanks in advance, Mischa.

Edit: below a more concise iteration of the patch, rebased on current trunk (r13364):

#2 Updated by Jean-Baptiste Barth over 3 years ago

  • Status changed from Needs feedback to Closed
  • Target version set to 2.5.3
  • Resolution set to Fixed

No problem Mischa, done in r13365/r13366. I removed the comment which was trivial imho. Thanks!

Also available in: Atom PDF