mirror of
https://github.com/redmine/redmine.git
synced 2025-10-26 07:46:17 +01:00
Fix RuboCop offense Style/RedundantInterpolationUnfreeze (#39887).
Since interpolated strings are always unfrozen in Ruby 3.0 and later, the use of `+""` is now redundant. git-svn-id: https://svn.redmine.org/redmine/trunk@23001 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -68,11 +68,11 @@ class JournalsController < ApplicationController
|
||||
if @journal
|
||||
user = @journal.user
|
||||
text = @journal.notes
|
||||
@content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => user, :link => "#note-#{params[:journal_indice]}"})}\n> "
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote_in, {:value => user, :link => "#note-#{params[:journal_indice]}"})}\n> "
|
||||
else
|
||||
user = @issue.author
|
||||
text = @issue.description
|
||||
@content = +"#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
end
|
||||
# Replaces pre blocks with [...]
|
||||
text = text.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]')
|
||||
|
||||
@@ -120,9 +120,9 @@ class MessagesController < ApplicationController
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
if @message.root == @message
|
||||
@content = +"#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
|
||||
else
|
||||
@content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => @message.author, :link => "message##{@message.id}"})}\n> "
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote_in, {:value => @message.author, :link => "message##{@message.id}"})}\n> "
|
||||
end
|
||||
@content << @message.content.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ class RepositoriesController < ApplicationController
|
||||
if params[:format] == 'diff'
|
||||
@diff = @repository.diff(@path, @rev, @rev_to)
|
||||
(show_error_not_found; return) unless @diff
|
||||
filename = +"changeset_r#{@rev}"
|
||||
filename = "changeset_r#{@rev}"
|
||||
filename << "_r#{@rev_to}" if @rev_to
|
||||
send_data @diff.join, :filename => "#{filename}.diff",
|
||||
:type => 'text/x-patch',
|
||||
|
||||
@@ -361,7 +361,7 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def toggle_link(name, id, options={})
|
||||
onclick = +"$('##{id}').toggle(); "
|
||||
onclick = "$('##{id}').toggle(); "
|
||||
onclick << (options[:focus] ? "$('##{options[:focus]}:visible').focus(); " : "this.blur(); ")
|
||||
onclick << "$(window).scrollTop($('##{options[:focus]}').position().top); " if options[:scroll]
|
||||
onclick << "return false;"
|
||||
@@ -1479,7 +1479,7 @@ module ApplicationHelper
|
||||
div_class = +'toc'
|
||||
div_class << ' right' if right_align
|
||||
div_class << ' left' if left_align
|
||||
out = +"<ul class=\"#{div_class}\"><li><strong>#{l :label_table_of_contents}</strong></li><li>"
|
||||
out = "<ul class=\"#{div_class}\"><li><strong>#{l :label_table_of_contents}</strong></li><li>"
|
||||
root = headings.map(&:first).min
|
||||
current = root
|
||||
started = false
|
||||
|
||||
@@ -96,7 +96,7 @@ module IssuesHelper
|
||||
issue.descendants.visible.
|
||||
preload(:status, :priority, :tracker,
|
||||
:assigned_to).sort_by(&:lft)) do |child, level|
|
||||
css = +"issue issue-#{child.id} hascontextmenu #{child.css_classes}"
|
||||
css = "issue issue-#{child.id} hascontextmenu #{child.css_classes}"
|
||||
css << " idnt idnt-#{level}" if level > 0
|
||||
buttons =
|
||||
if manage_relations
|
||||
|
||||
@@ -25,7 +25,7 @@ module WikiHelper
|
||||
s = (+'').html_safe
|
||||
if pages.has_key?(parent)
|
||||
pages[parent].each do |page|
|
||||
attrs = +"value='#{page.id}'"
|
||||
attrs = "value='#{page.id}'"
|
||||
attrs << " selected='selected'" if selected == page
|
||||
indent = (level > 0) ? (' ' * level * 2 + '» ') : ''
|
||||
|
||||
|
||||
@@ -1459,7 +1459,7 @@ class Issue < ApplicationRecord
|
||||
|
||||
# Returns a string of css classes that apply to the issue
|
||||
def css_classes(user=User.current)
|
||||
s = +"issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
|
||||
s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
|
||||
s << ' closed' if closed?
|
||||
s << ' overdue' if overdue?
|
||||
s << ' child' if child?
|
||||
|
||||
@@ -72,7 +72,7 @@ class Principal < ApplicationRecord
|
||||
where({})
|
||||
else
|
||||
pattern = "%#{sanitize_sql_like q}%"
|
||||
sql = +"LOWER(#{table_name}.login) LIKE LOWER(:p) ESCAPE :s"
|
||||
sql = "LOWER(#{table_name}.login) LIKE LOWER(:p) ESCAPE :s"
|
||||
sql << " OR #{table_name}.id IN (SELECT user_id FROM #{EmailAddress.table_name} WHERE LOWER(address) LIKE LOWER(:p) ESCAPE :s)"
|
||||
params = {:p => pattern, :s => '\\'}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ module Redmine
|
||||
|
||||
# Get info about the svn repository
|
||||
def info
|
||||
cmd = +"#{self.class.sq_bin} info --xml #{target}"
|
||||
cmd = "#{self.class.sq_bin} info --xml #{target}"
|
||||
cmd << credentials_string
|
||||
info = nil
|
||||
shellout(cmd) do |io|
|
||||
@@ -98,7 +98,7 @@ module Redmine
|
||||
path ||= ''
|
||||
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
|
||||
entries = Entries.new
|
||||
cmd = +"#{self.class.sq_bin} list --xml #{target(path)}@#{identifier}"
|
||||
cmd = "#{self.class.sq_bin} list --xml #{target(path)}@#{identifier}"
|
||||
cmd << credentials_string
|
||||
shellout(cmd) do |io|
|
||||
output = io.read.force_encoding('UTF-8')
|
||||
@@ -146,7 +146,7 @@ module Redmine
|
||||
return nil unless self.class.client_version_above?([1, 5, 0])
|
||||
|
||||
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
|
||||
cmd = +"#{self.class.sq_bin} proplist --verbose --xml #{target(path)}@#{identifier}"
|
||||
cmd = "#{self.class.sq_bin} proplist --verbose --xml #{target(path)}@#{identifier}"
|
||||
cmd << credentials_string
|
||||
properties = {}
|
||||
shellout(cmd) do |io|
|
||||
@@ -169,7 +169,7 @@ module Redmine
|
||||
identifier_from = (identifier_from && identifier_from.to_i > 0) ? identifier_from.to_i : "HEAD"
|
||||
identifier_to = (identifier_to && identifier_to.to_i > 0) ? identifier_to.to_i : 1
|
||||
revisions = Revisions.new
|
||||
cmd = +"#{self.class.sq_bin} log --xml -r #{identifier_from}:#{identifier_to}"
|
||||
cmd = "#{self.class.sq_bin} log --xml -r #{identifier_from}:#{identifier_to}"
|
||||
cmd << credentials_string
|
||||
cmd << " --verbose " if options[:with_paths]
|
||||
cmd << " --limit #{options[:limit].to_i}" if options[:limit]
|
||||
@@ -218,7 +218,7 @@ module Redmine
|
||||
|
||||
identifier_to = (identifier_to and identifier_to.to_i > 0) ? identifier_to.to_i : (identifier_from.to_i - 1)
|
||||
|
||||
cmd = +"#{self.class.sq_bin} diff -r "
|
||||
cmd = "#{self.class.sq_bin} diff -r "
|
||||
cmd << "#{identifier_to}:"
|
||||
cmd << "#{identifier_from}"
|
||||
cmd << " #{target(path)}@#{identifier_from}"
|
||||
@@ -236,7 +236,7 @@ module Redmine
|
||||
|
||||
def cat(path, identifier=nil)
|
||||
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
|
||||
cmd = +"#{self.class.sq_bin} cat #{target(path)}@#{identifier}"
|
||||
cmd = "#{self.class.sq_bin} cat #{target(path)}@#{identifier}"
|
||||
cmd << credentials_string
|
||||
cat = nil
|
||||
shellout(cmd) do |io|
|
||||
@@ -250,7 +250,7 @@ module Redmine
|
||||
|
||||
def annotate(path, identifier=nil)
|
||||
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
|
||||
cmd = +"#{self.class.sq_bin} blame #{target(path)}@#{identifier}"
|
||||
cmd = "#{self.class.sq_bin} blame #{target(path)}@#{identifier}"
|
||||
cmd << credentials_string
|
||||
blame = Annotate.new
|
||||
shellout(cmd) do |io|
|
||||
|
||||
@@ -580,9 +580,9 @@ class RedCloth3 < String
|
||||
depth << tl
|
||||
atts = pba(atts)
|
||||
atts = shelve(atts) if atts
|
||||
lines[line_id] = +"\t<#{lT(tl)}l#{atts}>\n\t<li>#{content}"
|
||||
lines[line_id] = "\t<#{lT(tl)}l#{atts}>\n\t<li>#{content}"
|
||||
else
|
||||
lines[line_id] = +"\t\t<li>#{content}"
|
||||
lines[line_id] = "\t\t<li>#{content}"
|
||||
end
|
||||
last_line = line_id
|
||||
else
|
||||
@@ -632,7 +632,7 @@ class RedCloth3 < String
|
||||
text.gsub!(CODE_RE) do |m|
|
||||
before, lang, code, after = $~[1..4]
|
||||
lang = " lang=\"#{lang}\"" if lang
|
||||
rip_offtags(+"#{before}<code#{lang}>#{code}</code>#{after}", false)
|
||||
rip_offtags("#{before}<code#{lang}>#{code}</code>#{after}", false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -844,7 +844,7 @@ class RedCloth3 < String
|
||||
next all unless uri_with_link_safe_scheme?(url)
|
||||
|
||||
atts = pba(atts)
|
||||
atts = +" href=\"#{url}#{slash}\"#{atts}"
|
||||
atts = " href=\"#{url}#{slash}\"#{atts}"
|
||||
atts << " title=\"#{htmlesc title}\"" if title
|
||||
atts = shelve(atts) if atts
|
||||
external = (url =~ /^https?:\/\//) ? ' class="external"' : ''
|
||||
@@ -953,7 +953,7 @@ class RedCloth3 < String
|
||||
stln, algn, atts, url, title, href, href_a1, href_a2 = $~[1..8]
|
||||
htmlesc title
|
||||
atts = pba(atts)
|
||||
atts = +" src=\"#{htmlesc url.dup}\"#{atts}"
|
||||
atts = " src=\"#{htmlesc url.dup}\"#{atts}"
|
||||
atts << " title=\"#{title}\"" if title
|
||||
atts << " alt=\"#{title}\""
|
||||
# size = @getimagesize($url);
|
||||
@@ -1099,12 +1099,12 @@ class RedCloth3 < String
|
||||
### NB: some changes were made not to use $N variables, because we use "match"
|
||||
### and it breaks following lines
|
||||
htmlesc(aftertag, :NoQuotes) if aftertag && escape_aftertag && !first.match(/<code\s+class="(\w+)">/)
|
||||
line = +"<redpre##{@pre_list.length}>"
|
||||
line = "<redpre##{@pre_list.length}>"
|
||||
first =~ /<#{OFFTAGS}([^>]*)>/o
|
||||
tag = $1
|
||||
$2.to_s =~ /(class\=("[^"]+"|'[^']+'))/i
|
||||
tag << " #{$1}" if $1 && tag == 'code'
|
||||
@pre_list << +"<#{tag}>#{aftertag}"
|
||||
@pre_list << "<#{tag}>#{aftertag}"
|
||||
end
|
||||
elsif $1 and codepre > 0
|
||||
if codepre - used_offtags.length > 0
|
||||
|
||||
@@ -310,7 +310,7 @@ class RepositoryTest < ActiveSupport::TestCase
|
||||
)
|
||||
long_whitespace = " "
|
||||
expected_comment = "This is a loooooooooooooooooooooooooooong comment"
|
||||
comment = +"#{expected_comment}#{long_whitespace}\n"
|
||||
comment = "#{expected_comment}#{long_whitespace}\n"
|
||||
3.times {comment << "#{long_whitespace}\n"}
|
||||
changeset = Changeset.new(
|
||||
:comments => comment, :commit_date => Time.now,
|
||||
|
||||
Reference in New Issue
Block a user