From: Go MAEDA Date: Sun, 17 Mar 2019 16:36:34 +0000 (+0000) Subject: Support frozen_string_literal in lib/**/*.rb (#26561). X-Git-Tag: 4.1.0~1028 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=30e341db6963d71fccf2d1bf24744ab828bee151;p=redmine.git Support frozen_string_literal in lib/**/*.rb (#26561). Contributed by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@17988 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/plugins/acts_as_activity_provider/init.rb b/lib/plugins/acts_as_activity_provider/init.rb index 781bd3f47..465ab3b9b 100644 --- a/lib/plugins/acts_as_activity_provider/init.rb +++ b/lib/plugins/acts_as_activity_provider/init.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.dirname(__FILE__) + '/lib/acts_as_activity_provider' ActiveRecord::Base.send(:include, Redmine::Acts::ActivityProvider) diff --git a/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb b/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb index 325176ddf..e92f68146 100644 --- a/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb +++ b/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang diff --git a/lib/plugins/acts_as_attachable/init.rb b/lib/plugins/acts_as_attachable/init.rb index 66ecc7849..fad72214c 100644 --- a/lib/plugins/acts_as_attachable/init.rb +++ b/lib/plugins/acts_as_attachable/init.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.dirname(__FILE__) + '/lib/acts_as_attachable' ActiveRecord::Base.send(:include, Redmine::Acts::Attachable) diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb index b895a9f55..4a2ce9055 100644 --- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb +++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang diff --git a/lib/plugins/acts_as_customizable/init.rb b/lib/plugins/acts_as_customizable/init.rb index 2139e96c6..c44db3df0 100644 --- a/lib/plugins/acts_as_customizable/init.rb +++ b/lib/plugins/acts_as_customizable/init.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.dirname(__FILE__) + '/lib/acts_as_customizable' ActiveRecord::Base.send(:include, Redmine::Acts::Customizable) diff --git a/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb b/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb index 5413a456f..a5568f635 100644 --- a/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb +++ b/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang diff --git a/lib/plugins/acts_as_event/init.rb b/lib/plugins/acts_as_event/init.rb index 2a78cd2d3..2c025f2c0 100644 --- a/lib/plugins/acts_as_event/init.rb +++ b/lib/plugins/acts_as_event/init.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.dirname(__FILE__) + '/lib/acts_as_event' ActiveRecord::Base.send(:include, Redmine::Acts::Event) diff --git a/lib/plugins/acts_as_event/lib/acts_as_event.rb b/lib/plugins/acts_as_event/lib/acts_as_event.rb index f77c12d70..2ff1eea12 100644 --- a/lib/plugins/acts_as_event/lib/acts_as_event.rb +++ b/lib/plugins/acts_as_event/lib/acts_as_event.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang diff --git a/lib/plugins/acts_as_searchable/init.rb b/lib/plugins/acts_as_searchable/init.rb index 204d0ce36..661b0203d 100644 --- a/lib/plugins/acts_as_searchable/init.rb +++ b/lib/plugins/acts_as_searchable/init.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.dirname(__FILE__) + '/lib/acts_as_searchable' ActiveRecord::Base.send(:include, Redmine::Acts::Searchable) diff --git a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb index 79a3f88fb..61c1704fe 100644 --- a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb +++ b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang diff --git a/lib/plugins/acts_as_tree/Rakefile b/lib/plugins/acts_as_tree/Rakefile index 255df7de4..bf194199a 100644 --- a/lib/plugins/acts_as_tree/Rakefile +++ b/lib/plugins/acts_as_tree/Rakefile @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rake' require 'rake/testtask' diff --git a/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb b/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb index 668c600c4..14dce355a 100644 --- a/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb +++ b/lib/plugins/acts_as_tree/lib/active_record/acts/tree.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true module ActiveRecord module Acts diff --git a/lib/plugins/acts_as_tree/test/acts_as_tree_test.rb b/lib/plugins/acts_as_tree/test/acts_as_tree_test.rb index 81a0033c5..9ee4b8a42 100644 --- a/lib/plugins/acts_as_tree/test/acts_as_tree_test.rb +++ b/lib/plugins/acts_as_tree/test/acts_as_tree_test.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' diff --git a/lib/plugins/acts_as_watchable/init.rb b/lib/plugins/acts_as_watchable/init.rb index 4a9a14237..d91feec41 100644 --- a/lib/plugins/acts_as_watchable/init.rb +++ b/lib/plugins/acts_as_watchable/init.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Include hook code here require File.dirname(__FILE__) + '/lib/acts_as_watchable' diff --git a/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb b/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb index 8890326d1..1ebe9e2fc 100644 --- a/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb +++ b/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # ActsAsWatchable module Redmine diff --git a/lib/plugins/gravatar/init.rb b/lib/plugins/gravatar/init.rb index 65c9fce00..5bf49923d 100644 --- a/lib/plugins/gravatar/init.rb +++ b/lib/plugins/gravatar/init.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'gravatar' ActionView::Base.send :include, GravatarHelper::PublicMethods diff --git a/lib/plugins/open_id_authentication/lib/open_id_authentication.rb b/lib/plugins/open_id_authentication/lib/open_id_authentication.rb index 7754afece..711a38d43 100644 --- a/lib/plugins/open_id_authentication/lib/open_id_authentication.rb +++ b/lib/plugins/open_id_authentication/lib/open_id_authentication.rb @@ -89,7 +89,7 @@ module OpenIdAuthentication # dodge XRIs -- TODO: validate, don't just skip. unless ['=', '@', '+', '$', '!', '('].include?(identifier.at(0)) # does it begin with http? if not, add it. - identifier = "http://#{identifier}" unless identifier =~ /^http/i + identifier = +"http://#{identifier}" unless identifier =~ /^http/i # strip any fragments identifier.gsub!(/\#(.*)$/, '') diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb index 29be3c9fd..e1aba49f5 100644 --- a/lib/redmine/field_format.rb +++ b/lib/redmine/field_format.rb @@ -185,7 +185,7 @@ module Redmine def parse_keyword(custom_field, keyword, &block) separator = Regexp.escape "," - keyword = keyword.to_s + keyword = keyword.dup.to_s if custom_field.multiple? values = [] diff --git a/lib/redmine/helpers/diff.rb b/lib/redmine/helpers/diff.rb index 6f61e3e52..1217121ad 100644 --- a/lib/redmine/helpers/diff.rb +++ b/lib/redmine/helpers/diff.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -46,7 +46,7 @@ module Redmine add_at = nil add_to = nil del_at = nil - deleted = "" + deleted = +"" diff.each do |change| pos = change[1] if change[0] == "+" diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index abe783267..ac2b34e3d 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -76,8 +76,8 @@ module Redmine end @date_from = Date.civil(@year_from, @month_from, 1) @date_to = (@date_from >> @months) - 1 - @subjects = '' - @lines = '' + @subjects = +'' + @lines = +'' @number_of_rows = nil @truncated = false if options.has_key?(:max_rows) @@ -198,8 +198,8 @@ module Redmine :indent_increment => 20, :render => :subject, :format => :html}.merge(options) indent = options[:indent] || 4 - @subjects = '' unless options[:only] == :lines - @lines = '' unless options[:only] == :subjects + @subjects = +'' unless options[:only] == :lines + @lines = +'' unless options[:only] == :subjects @number_of_rows = 0 begin Project.project_tree(projects) do |project, level| @@ -652,7 +652,7 @@ module Redmine case object when Issue issue = object - css_classes = '' + css_classes = +'' css_classes << ' issue-overdue' if issue.overdue? css_classes << ' issue-behind-schedule' if issue.behind_schedule? css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to @@ -663,7 +663,7 @@ module Redmine css_classes << ' behind-start-date' if progress_date < self.date_from css_classes << ' over-end-date' if progress_date > self.date_to end - s = "".html_safe + s = (+"").html_safe if issue.assigned_to.present? assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name s << view.avatar(issue.assigned_to, @@ -676,7 +676,7 @@ module Redmine view.content_tag(:span, s, :class => css_classes).html_safe when Version version = object - html_class = "" + html_class = +"" html_class << 'icon icon-package ' html_class << (version.behind_schedule? ? 'version-behind-schedule' : '') << " " html_class << (version.overdue? ? 'version-overdue' : '') @@ -691,7 +691,7 @@ module Redmine view.content_tag(:span, s, :class => html_class).html_safe when Project project = object - html_class = "" + html_class = +"" html_class << 'icon icon-projects ' html_class << (project.overdue? ? 'project-overdue' : '') s = view.link_to_project(project).html_safe @@ -727,7 +727,7 @@ module Redmine end if has_children content = view.content_tag(:span, nil, :class => :expander) + content - tag_options[:class] << ' open' + tag_options[:class] += ' open' else if params[:indent] params = params.dup @@ -735,7 +735,7 @@ module Redmine end end style = "position: absolute;top:#{params[:top]}px;left:#{params[:indent]}px;" - style << "width:#{params[:subject_width] - params[:indent]}px;" if params[:subject_width] + style += "width:#{params[:subject_width] - params[:indent]}px;" if params[:subject_width] tag_options[:style] = style output = view.content_tag(:div, content, tag_options) @subjects << output @@ -774,7 +774,7 @@ module Redmine end def html_task(params, coords, markers, label, object) - output = '' + output = +'' data_options = {} data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase if object @@ -792,7 +792,7 @@ module Redmine # Renders the task bar, with progress and late if coords[:bar_start] && coords[:bar_end] width = coords[:bar_end] - coords[:bar_start] - 2 - style = "" + style = +"" style << "top:#{params[:top]}px;" style << "left:#{coords[:bar_start]}px;" style << "width:#{width}px;" @@ -812,7 +812,7 @@ module Redmine output << view.content_tag(:div, ' '.html_safe, content_opt) if coords[:bar_late_end] width = coords[:bar_late_end] - coords[:bar_start] - 2 - style = "" + style = +"" style << "top:#{params[:top]}px;" style << "left:#{coords[:bar_start]}px;" style << "width:#{width}px;" @@ -823,7 +823,7 @@ module Redmine end if coords[:bar_progress_end] width = coords[:bar_progress_end] - coords[:bar_start] - 2 - style = "" + style = +"" style << "top:#{params[:top]}px;" style << "left:#{coords[:bar_start]}px;" style << "width:#{width}px;" @@ -839,7 +839,7 @@ module Redmine # Renders the markers if markers if coords[:start] - style = "" + style = +"" style << "top:#{params[:top]}px;" style << "left:#{coords[:start]}px;" style << "width:15px;" @@ -849,7 +849,7 @@ module Redmine :data => data_options) end if coords[:end] - style = "" + style = +"" style << "top:#{params[:top]}px;" style << "left:#{coords[:end] + params[:zoom]}px;" style << "width:15px;" @@ -861,7 +861,7 @@ module Redmine end # Renders the label on the right if label - style = "" + style = +"" style << "top:#{params[:top]}px;" style << "left:#{(coords[:bar_end] || 0) + 8}px;" style << "width:15px;" @@ -876,7 +876,7 @@ module Redmine view.render_issue_tooltip(object).html_safe, :class => "tip") s += view.content_tag(:input, nil, :type => 'checkbox', :name => 'ids[]', :value => object.id, :style => 'display:none;', :class => 'toggle-selection') - style = "" + style = +"" style << "position: absolute;" style << "top:#{params[:top]}px;" style << "left:#{coords[:bar_start]}px;" diff --git a/lib/redmine/info.rb b/lib/redmine/info.rb index 276c72d40..a51deb227 100644 --- a/lib/redmine/info.rb +++ b/lib/redmine/info.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true module Redmine module Info @@ -9,7 +9,7 @@ module Redmine def versioned_name; "#{app_name} #{Redmine::VERSION}" end def environment - s = "Environment:\n" + s = +"Environment:\n" s << [ ["Redmine version", Redmine::VERSION], ["Ruby version", "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"], diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb index f549897ac..b51251b69 100644 --- a/lib/redmine/pagination.rb +++ b/lib/redmine/pagination.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -159,7 +159,7 @@ module Redmine per_page_links = false if count.nil? page_param = paginator.page_param - html = '