]> git.openstreetmap.org Git - rails.git/commitdiff
Fix new rubocop warnings
authorTom Hughes <tom@compton.nu>
Tue, 27 Jun 2023 17:13:33 +0000 (18:13 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 27 Jun 2023 17:13:33 +0000 (18:13 +0100)
app/helpers/user_mailer_helper.rb
app/models/language.rb
lib/osm_community_index.rb

index 39977f5a7339a524ef95b81376e08ba98857d3dd..e5d6e39aca4a6259f95a92c1ed2c873d63877ed0 100644 (file)
@@ -29,7 +29,7 @@ module UserMailerHelper
     # Because we can't use stylesheets in HTML emails, we need to inline the
     # styles. Rather than copy-paste the same string of CSS into every message,
     # we apply it once here, after the message has been composed.
-    html.gsub(/<p>/, '<p style="color: black; margin: 0.75em 0; font-family: \'Helvetica Neue\', Arial, Sans-Serif">')
+    html.gsub("<p>", '<p style="color: black; margin: 0.75em 0; font-family: \'Helvetica Neue\', Arial, Sans-Serif">')
   end
 
   def style_left
index 1158721e8de9cf062ff911bd6d6ee5028393d445..f346c8a748aeb94dc44bf6d4d8769ffe8ba0bdaa 100644 (file)
@@ -14,7 +14,7 @@ class Language < ApplicationRecord
 
   def self.load(file)
     Language.transaction do
-      YAML.safe_load(File.read(file)).each do |k, v|
+      YAML.safe_load_file(file).each do |k, v|
         Language.update(k, :english_name => v["english"], :native_name => v["native"])
       rescue ActiveRecord::RecordNotFound
         Language.create do |l|
index 7ce379d0f54cae7b755d78035dc7585a245c49f7..a5c2fba72d2b93c9f1e6a566e0cf2ba95f6a1d94 100644 (file)
@@ -6,7 +6,7 @@ module OsmCommunityIndex
     files = Rails.root.glob("node_modules/osm-community-index/i18n/*.yaml")
     files.each do |file|
       locale = File.basename(file, ".yaml")
-      community_locale_yaml = YAML.safe_load(File.read(file))[locale]
+      community_locale_yaml = YAML.safe_load_file(file)[locale]
       # rails wants language-COUNTRY but osm-community-index uses underscores
       locale_rails = locale.tr("_", "-")