プロジェクト

全般

プロフィール

Vote #74322

完了

Yard rake file is not updated for Redmine 2.x

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
86
issue_org_id:
14796
author_id:
1565
assigned_to_id:
1188
comments:
2
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

The YARD rake file is not yet updated to match the current (Redmine 2.x) locations of plugins, which causes two issues:

yard is parsing test files of core plugins, while it shouldn't

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)

journals

@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):

{{collapse(Updated patch...)
<pre><code class="diff">
Index: lib/tasks/yardoc.rake
===================================================================
--- lib/tasks/yardoc.rake (revision 13364)
+++ lib/tasks/yardoc.rake (working copy)
@@ -2,8 +2,9 @@
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', 'plugins/**/*.rb'].reject {|f| f.match(/test/) }
t.files = files

static_files = ['doc/CHANGELOG',
</code></pre>
}}

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

Admin Redmine さんが約4年前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン2.5.3_86 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0