]> git.openstreetmap.org Git - rails.git/commitdiff
Prefer string interpolation to concatenation
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 28 Oct 2020 16:15:14 +0000 (17:15 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 28 Oct 2020 16:15:14 +0000 (17:15 +0100)
.rubocop_todo.yml
app/helpers/note_helper.rb
app/helpers/title_helper.rb
lib/bounding_box.rb
lib/osm.rb

index cfff8c43e2cd9459cb02f157d9bf5adf2f633db6..96bf94b8e6241dd49d91d310ad1197385caacda0 100644 (file)
@@ -189,7 +189,20 @@ Style/OptionalBooleanParameter:
     - 'test/models/trace_test.rb'
     - 'test/models/tracetag_test.rb'
 
-# Offense count: 28
+# Offense count: 19
 # Cop supports --auto-correct.
 Style/StringConcatenation:
-  Enabled: false
+  Exclude:
+    - 'app/helpers/browse_tags_helper.rb'
+    - 'app/helpers/user_roles_helper.rb'
+    - 'app/jobs/trace_importer_job.rb'
+    - 'app/models/client_application.rb'
+    - 'app/views/changesets/index.atom.builder'
+    - 'lib/migrate.rb'
+    - 'lib/potlatch.rb'
+    - 'script/cleanup'
+    - 'script/deliver-message'
+    - 'script/statistics'
+    - 'script/update-spam-blocks'
+    - 'test/controllers/api/relations_controller_test.rb'
+    - 'test/helpers/user_roles_helper_test.rb'
index d85881a3111027cb3fe8f5b178deb0fc1acb6486..7e52937a008f94903a9e2c9fe57ea2c3e541f275 100644 (file)
@@ -3,11 +3,11 @@ module NoteHelper
 
   def note_event(event, at, by)
     if by.nil?
-      t("browse.note." + event + "_by_anonymous_html",
+      t("browse.note.#{event}_by_anonymous_html",
         :when => friendly_date_ago(at),
         :exact_time => l(at))
     else
-      t("browse.note." + event + "_by_html",
+      t("browse.note.#{event}_by_html",
         :when => friendly_date_ago(at),
         :exact_time => l(at),
         :user => note_author(by))
index 16470343656a1880a25eae74e6be6ba4c6417f38..099af86815264d1f8bc4a3bb98e472e63aae7c86 100644 (file)
@@ -6,7 +6,7 @@ module TitleHelper
   def set_title(title = nil)
     if title
       @title = TitleHelper.coder.decode(title.gsub("<bdi>", "\u202a").gsub("</bdi>", "\u202c"))
-      response.headers["X-Page-Title"] = ERB::Util.u(@title + " | " + t("layouts.project_name.title"))
+      response.headers["X-Page-Title"] = ERB::Util.u("#{@title} | #{t('layouts.project_name.title')}")
     else
       @title = title
       response.headers["X-Page-Title"] = ERB::Util.u(t("layouts.project_name.title"))
index 0b9731b227223f454801f82b1e71fc1d92036511..44375ae5beb85aca7b5ece0ad2f20423975194fd 100644 (file)
@@ -72,7 +72,7 @@ class BoundingBox
   def check_size(max_area = Settings.max_request_area)
     # check the bbox isn't too large
     if area > max_area
-      raise OSM::APIBadBoundingBox, "The maximum bbox size is " + max_area.to_s +
+      raise OSM::APIBadBoundingBox, "The maximum bbox size is #{max_area}" \
                                     ", and your request was too large. Either request a smaller area, or use planet.osm"
     end
     self
index 04cbf17faf193e215463281e31bd2e031bb96ee3..a6d74067772c0d415aa98508002d5efc28c3c87d 100644 (file)
@@ -497,8 +497,8 @@ module OSM
 
   # Return the terms and conditions text for a given country
   def self.legal_text_for_country(country_code)
-    file_name = Rails.root.join("config", "legales", country_code.to_s + ".yml")
-    file_name = Rails.root.join("config", "legales", Settings.default_legale + ".yml") unless File.exist? file_name
+    file_name = Rails.root.join("config", "legales", "#{country_code}.yml")
+    file_name = Rails.root.join("config", "legales", "#{Settings.default_legale}.yml") unless File.exist? file_name
     YAML.load_file(file_name).transform_values!(&:html_safe)
   end