diff options
author | Go MAEDA <maeda@farend.jp> | 2023-01-11 13:31:57 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-01-11 13:31:57 +0000 |
commit | 62a930cc65472133123f674c4bbdfcbd822cc731 (patch) | |
tree | da087327819b8fee07b5d046260d20078451c3ce /lib/redmine | |
parent | dbf8c1d921ce227d8fde88b62113a17fc8fe778d (diff) | |
download | redmine-62a930cc65472133123f674c4bbdfcbd822cc731.tar.gz redmine-62a930cc65472133123f674c4bbdfcbd822cc731.zip |
Fix RuboCop offense Performance/RedundantMatch (#38146).
git-svn-id: https://svn.redmine.org/redmine/trunk@22032 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r-- | lib/redmine/wiki_formatting/textile/formatter.rb | 2 | ||||
-rw-r--r-- | lib/redmine/wiki_formatting/textile/redcloth3.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index 04464763e..53c04341d 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -109,7 +109,7 @@ module Redmine text.gsub!(/<redpre#(\d+)>/) do content = @pre_list[$1.to_i] # This regex must match any data produced by RedCloth3#rip_offtags - if content.match(/<code\s+class=(?:"([^"]+)"|'([^']+)')>\s?(.*)/m) + if content =~ /<code\s+class=(?:"([^"]+)"|'([^']+)')>\s?(.*)/m language = $1 || $2 text = $3 # original language for extension development diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 637f2883e..77bfa0ab6 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -1100,9 +1100,9 @@ class RedCloth3 < String ### and it breaks following lines htmlesc( aftertag, :NoQuotes ) if aftertag && escape_aftertag && !first.match(/<code\s+class="(\w+)">/) line = +"<redpre##{@pre_list.length}>" - first.match(/<#{OFFTAGS}([^>]*)>/o) + first =~ /<#{OFFTAGS}([^>]*)>/o tag = $1 - $2.to_s.match(/(class\=("[^"]+"|'[^']+'))/i) + $2.to_s =~ /(class\=("[^"]+"|'[^']+'))/i tag << " #{$1}" if $1 && tag == 'code' @pre_list << +"<#{tag}>#{aftertag}" end |