From bd5977d97eaf92f852c1bfe499052b6b07ab8aae Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 17 Mar 2019 13:36:03 +0000 Subject: [PATCH] Support frozen_string_literal in app/**/*.rb (#26561). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contributed by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@17987 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/attachments_controller.rb | 2 +- app/controllers/messages_controller.rb | 4 ++-- app/controllers/repositories_controller.rb | 2 +- app/controllers/search_controller.rb | 5 ++--- app/helpers/application_helper.rb | 26 +++++++++++----------- app/helpers/attachments_helper.rb | 2 +- app/helpers/calendars_helper.rb | 4 ++-- app/helpers/context_menus_helper.rb | 6 ++--- app/helpers/custom_fields_helper.rb | 6 ++--- app/helpers/projects_helper.rb | 6 ++--- app/helpers/repositories_helper.rb | 8 +++---- app/helpers/search_helper.rb | 4 ++-- app/helpers/wiki_helper.rb | 6 ++--- app/models/attachment.rb | 2 +- app/models/auth_source_ldap.rb | 2 +- app/models/mailer.rb | 10 ++++----- app/models/principal.rb | 4 ++-- app/models/project.rb | 6 ++--- app/models/repository.rb | 6 ++--- app/models/repository/bazaar.rb | 2 +- app/models/repository/cvs.rb | 6 ++--- app/models/repository/filesystem.rb | 2 +- app/models/repository/git.rb | 2 +- app/models/repository/mercurial.rb | 2 +- app/models/repository/subversion.rb | 2 +- app/models/user.rb | 4 ++-- 26 files changed, 65 insertions(+), 66 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 4b8199166..1f1b05899 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.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/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 9cffeea70..f0e289be2 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -117,7 +117,7 @@ class MessagesController < ApplicationController @subject = @message.subject @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:') - @content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> " + @content = +"#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> " @content << @message.content.to_s.strip.gsub(%r{
(.*?)
}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 5fdac37e9..e0af12a3c 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.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/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 8ae53e7ff..b48ebc38c 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -22,8 +22,7 @@ class SearchController < ApplicationController accept_api_auth :index def index - @question = params[:q] || "" - @question.strip! + @question = params[:q]&.strip || "" @all_words = params[:all_words] ? params[:all_words].present? : true @titles_only = params[:titles_only] ? params[:titles_only].present? : false @search_attachments = params[:attachments].presence || '0' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 23520d953..8dab89735 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # Redmine - project management software # Copyright (C) 2006-2017 Jean-Philippe Lang @@ -292,7 +292,7 @@ module ApplicationHelper end def toggle_link(name, id, options={}) - onclick = "$('##{id}').toggle(); " + onclick = +"$('##{id}').toggle(); " onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ") onclick << "$(window).scrollTop($('##{options[:focus]}').position().top); " if options[:scroll] onclick << "return false;" @@ -336,7 +336,7 @@ module ApplicationHelper # The given collection may be a subset of the whole project tree # (eg. some intermediate nodes are private and can not be seen) def render_project_nested_lists(projects, &block) - s = '' + s = +'' if projects.any? ancestors = [] original_project = @project @@ -366,7 +366,7 @@ module ApplicationHelper end def render_page_hierarchy(pages, node=nil, options={}) - content = '' + content = +'' if pages[node] content << "