]> git.openstreetmap.org Git - rails.git/commitdiff
Handle new rubocop warnings
authorTom Hughes <tom@compton.nu>
Wed, 2 Sep 2020 06:18:21 +0000 (07:18 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 2 Sep 2020 06:18:21 +0000 (07:18 +0100)
.rubocop_todo.yml
app/controllers/api/amf_controller.rb
app/controllers/users_controller.rb
app/models/concerns/geo_record.rb
lib/osm.rb

index 05c4f63e2fe185c3b52e33a52d39a4158f7e04e4..87bf43bc3b07c9b10f37aad04189693b807a66e3 100644 (file)
@@ -1,6 +1,6 @@
 # This configuration was generated by
 # `rubocop --auto-gen-config`
-# on 2020-08-09 18:49:49 UTC using RuboCop version 0.89.0.
+# on 2020-09-02 06:16:56 UTC using RuboCop version 0.90.0.
 # The point is for the user to remove these configuration records
 # one by one as the offenses are removed from the code base.
 # Note that changes in the inspected code, or installation of new
@@ -188,6 +188,11 @@ Rails/OutputSafety:
 Rails/TimeZone:
   Enabled: false
 
+# Offense count: 1
+Style/CombinableLoops:
+  Exclude:
+    - 'db/migrate/021_move_to_innodb.rb'
+
 # Offense count: 572
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
@@ -217,6 +222,16 @@ Style/OptionalBooleanParameter:
     - 'test/models/trace_test.rb'
     - 'test/models/tracetag_test.rb'
 
+# Offense count: 6
+# Configuration parameters: AllowModifier.
+Style/SoleNestedConditional:
+  Exclude:
+    - 'app/controllers/user_blocks_controller.rb'
+    - 'app/models/old_way.rb'
+    - 'app/validators/characters_validator.rb'
+    - 'app/validators/whitespace_validator.rb'
+    - 'lib/classic_pagination/pagination.rb'
+
 # Offense count: 28
 # Cop supports --auto-correct.
 Style/StringConcatenation:
index fc8a304bbc56513fbe1d1ce089e1354e7621e627..c903cc8e73698b3b36106db31e7a0fa69a3779b0 100644 (file)
@@ -87,7 +87,7 @@ module Api
           result = [-5, nil]
         else
           case message
-          when "putway" then
+          when "putway"
             orn = renumberednodes.dup
             result = putway(renumberednodes, *args)
             result[4] = renumberednodes.reject { |k, _v| orn.key?(k) }
@@ -96,7 +96,7 @@ module Api
             result = putrelation(renumberednodes, renumberedways, *args)
           when "deleteway"
             result = deleteway(*args)
-          when "putpoi" then
+          when "putpoi"
             result = putpoi(*args)
             renumberednodes[result[2]] = result[3] if result[0].zero? && result[2] != result[3]
           when "startchangeset"
index ed9c124b14b2b1983dee504132f7e69e612152d8..b3596b376634d84341046ad304d56b550f48b57a 100644 (file)
@@ -616,13 +616,13 @@ class UsersController < ApplicationController
     user.languages = params[:user][:languages].split(",")
 
     case params[:avatar_action]
-    when "new" then
+    when "new"
       user.avatar.attach(params[:user][:avatar])
       user.image_use_gravatar = false
-    when "delete" then
+    when "delete"
       user.avatar.purge_later
       user.image_use_gravatar = false
-    when "gravatar" then
+    when "gravatar"
       user.avatar.purge_later
       user.image_use_gravatar = true
     end
index a5635c1729b2610442df10a8019f30f2ad614029..23101856af59af4b1d79b98e6657942fad6f326a 100644 (file)
@@ -5,10 +5,6 @@ module GeoRecord
   # and not e.g. 4.0e-05
   # Unfortunately you can't extend Numeric classes directly (e.g. `Coord < Float`).
   class Coord < DelegateClass(Float)
-    def initialize(obj)
-      super(obj)
-    end
-
     def to_s
       format("%<coord>.7f", :coord => self)
     end
index a4ac7fc576aa91db7d47131e7c4866c7d4db0fbd..04cbf17faf193e215463281e31bd2e031bb96ee3 100644 (file)
@@ -247,10 +247,6 @@ module OSM
   ##
   # raised when user input couldn't be parsed
   class APIBadUserInput < APIError
-    def initialize(message)
-      super message
-    end
-
     def status
       :bad_request
     end
@@ -259,10 +255,6 @@ module OSM
   ##
   # raised when bounding box is invalid
   class APIBadBoundingBox < APIError
-    def initialize(message)
-      super message
-    end
-
     def status
       :bad_request
     end