From 957d75295b2c379b17e61a2a22ee28fb5f701589 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 8 Jun 2015 15:58:43 +0100 Subject: [PATCH] Fix warnings from rubocop update --- .rubocop_todo.yml | 29 ++++++++++++--------- app/controllers/changeset_controller.rb | 6 +++-- config.ru | 2 +- lib/classic_pagination/pagination_helper.rb | 3 ++- lib/diff_reader.rb | 3 +-- lib/osm.rb | 23 +++++++++++----- 6 files changed, 42 insertions(+), 24 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index fe8947599..e1b70a2d8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,5 +1,5 @@ # This configuration was generated by `rubocop --auto-gen-config` -# on 2015-04-14 09:29:11 +0100 using RuboCop version 0.30.0. +# on 2015-06-08 15:55:30 +0100 using RuboCop version 0.32.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 @@ -9,11 +9,11 @@ Lint/AmbiguousOperator: Enabled: false -# Offense count: 125 +# Offense count: 115 Lint/AmbiguousRegexpLiteral: Enabled: false -# Offense count: 31 +# Offense count: 30 # Configuration parameters: AllowSafeAssignment. Lint/AssignmentInCondition: Enabled: false @@ -26,7 +26,7 @@ Lint/HandleExceptions: Lint/ParenthesesAsGroupedExpression: Enabled: false -# Offense count: 646 +# Offense count: 669 Metrics/AbcSize: Max: 277 @@ -39,26 +39,31 @@ Metrics/BlockNesting: Metrics/ClassLength: Max: 1653 -# Offense count: 68 +# Offense count: 67 Metrics/CyclomaticComplexity: Max: 20 -# Offense count: 2454 +# Offense count: 2537 # Configuration parameters: AllowURI, URISchemes. Metrics/LineLength: Max: 694 -# Offense count: 601 +# Offense count: 623 # Configuration parameters: CountComments. Metrics/MethodLength: Max: 179 +# Offense count: 1 +# Configuration parameters: CountComments. +Metrics/ModuleLength: + Max: 126 + # Offense count: 4 # Configuration parameters: CountKeywordArgs. Metrics/ParameterLists: Max: 9 -# Offense count: 70 +# Offense count: 69 Metrics/PerceivedComplexity: Max: 23 @@ -67,7 +72,7 @@ Metrics/PerceivedComplexity: Rails/HasAndBelongsToMany: Enabled: false -# Offense count: 70 +# Offense count: 67 # Configuration parameters: EnforcedStyle, SupportedStyles. Rails/TimeZone: Enabled: false @@ -80,11 +85,11 @@ Style/AccessorMethodName: Style/AsciiComments: Enabled: false -# Offense count: 307 +# Offense count: 308 Style/Documentation: Enabled: false -# Offense count: 39 +# Offense count: 38 # Configuration parameters: MinBodyLength. Style/GuardClause: Enabled: false @@ -99,7 +104,7 @@ Style/LineEndConcatenation: Style/NumericLiterals: MinDigits: 11 -# Offense count: 41 +# Offense count: 42 # Cop supports --auto-correct. Style/PerlBackrefs: Enabled: false diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index e0d75985d..8a72d941d 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -95,8 +95,10 @@ class ChangesetController < ApplicationController lat << cs.max_lat unless cs.max_lat.nil? # collapse the arrays to minimum and maximum - cs.min_lon, cs.min_lat, cs.max_lon, cs.max_lat = - lon.min, lat.min, lon.max, lat.max + cs.min_lon = lon.min + cs.min_lat = lat.min + cs.max_lon = lon.max + cs.max_lat = lat.max # save the larger bounding box and return the changeset, which # will include the bigger bounding box. diff --git a/config.ru b/config.ru index bd83b2541..193e5fed8 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,4 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require ::File.expand_path("../config/environment", __FILE__) run Rails.application diff --git a/lib/classic_pagination/pagination_helper.rb b/lib/classic_pagination/pagination_helper.rb index da1bcbec6..238b8836e 100644 --- a/lib/classic_pagination/pagination_helper.rb +++ b/lib/classic_pagination/pagination_helper.rb @@ -99,7 +99,8 @@ module ActionView window_pages = current_page.window(options[:window_size]).pages return if window_pages.length <= 1 unless link_to_current_page - first, last = paginator.first, paginator.last + first = paginator.first + last = paginator.last html = "" diff --git a/lib/diff_reader.rb b/lib/diff_reader.rb index 3ec4f146a..459143076 100644 --- a/lib/diff_reader.rb +++ b/lib/diff_reader.rb @@ -124,8 +124,7 @@ class DiffReader # an exception subclassing OSM::APIError will be thrown. def commit # data structure used for mapping placeholder IDs to real IDs - node_ids, way_ids, rel_ids = {}, {}, {} - ids = { :node => node_ids, :way => way_ids, :relation => rel_ids } + ids = { :node => {}, :way => {}, :relation => {} } # take the first element and check that it is an osmChange element @reader.read diff --git a/lib/osm.rb b/lib/osm.rb index 6c54caadf..7556e631b 100644 --- a/lib/osm.rb +++ b/lib/osm.rb @@ -63,7 +63,8 @@ module OSM # Raised when to delete an already-deleted object. class APIAlreadyDeletedError < APIError def initialize(object = "object", object_id = "") - @object, @object_id = object, object_id + @object = object + @object_id = object_id end attr_reader :object, :object_id @@ -171,7 +172,8 @@ module OSM # the changeset ID that the diff was uploaded to. class APIChangesetMismatchError < APIError def initialize(provided, allowed) - @provided, @allowed = provided, allowed + @provided = provided + @allowed = allowed end def status @@ -203,7 +205,9 @@ module OSM # they should. class APIBadXMLError < APIError def initialize(model, xml, message = "") - @model, @xml, @message = model, xml, message + @model = model + @xml = xml + @message = message end def status @@ -218,7 +222,10 @@ module OSM # Raised when the provided version is not equal to the latest in the db. class APIVersionMismatchError < APIError def initialize(id, type, provided, latest) - @id, @type, @provided, @latest = id, type, provided, latest + @id = id + @type = type + @provided = provided + @latest = latest end attr_reader :provided, :latest, :id, :type @@ -236,7 +243,9 @@ module OSM # this is now forbidden by the API. class APIDuplicateTagsError < APIError def initialize(type, id, tag_key) - @type, @id, @tag_key = type, id, tag_key + @type = type + @id = id + @tag_key = tag_key end attr_reader :type, :id, :tag_key @@ -254,7 +263,9 @@ module OSM # This prevents ways from being to long and difficult to work with class APITooManyWayNodesError < APIError def initialize(id, provided, max) - @id, @provided, @max = id, provided, max + @id = id + @provided = provided + @max = max end attr_reader :id, :provided, :max -- 2.43.2