プロジェクト

全般

プロフィール

Vote #77979

完了

More readable regex for parse_redmine_links

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

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

0%

予定工数:
category_id:
30
version_id:
119
issue_org_id:
24382
author_id:
108604
assigned_to_id:
1
comments:
6
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

In method parse_redmine_links used very long regex that impossible to understand with first look.
Added names for capture groups.


journals

--------------------------------------------------------------------------------
Breaks a test:

<pre>
ruby test\unit\helpers\application_helper_test.rb
DL is deprecated, please use Fiddle
Run options: --seed 7252

# Running:

.............................................................E..................
....................

Finished in 2.519144s, 39.6960 runs/s, 154.0206 assertions/s.

1) Error:
ApplicationHelperTest#test_parse_redmine_links_should_handle_a_tag_without_attri
butes:
NoMethodError: undefined method `+' for nil:NilClass
app/helpers/application_helper.rb:943:in `block in parse_redmine_links'
app/helpers/application_helper.rb:800:in `gsub!'
app/helpers/application_helper.rb:800:in `parse_redmine_links'
test/unit/helpers/application_helper_test.rb:1279:in `test_parse_redmine_lin
ks_should_handle_a_tag_without_attributes'

100 runs, 388 assertions, 0 failures, 1 errors, 0 skips
</pre>
--------------------------------------------------------------------------------
Sorry, wrong place for "tag_content" capture group.
Fixed.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed, thanks for fixing the patch.
--------------------------------------------------------------------------------
Dmitry, that's a nice refactoring making the method a lot more readable and thus easier to understand.
--------------------------------------------------------------------------------

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

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

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

いいね!0
いいね!0