Fix warnings from rubocop update

This commit is contained in:
Tom Hughes 2015-06-08 15:58:43 +01:00
parent 726c149bd5
commit 957d75295b
6 changed files with 42 additions and 24 deletions

View file

@ -1,5 +1,5 @@
# This configuration was generated by `rubocop --auto-gen-config` # 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 # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
@ -9,11 +9,11 @@
Lint/AmbiguousOperator: Lint/AmbiguousOperator:
Enabled: false Enabled: false
# Offense count: 125 # Offense count: 115
Lint/AmbiguousRegexpLiteral: Lint/AmbiguousRegexpLiteral:
Enabled: false Enabled: false
# Offense count: 31 # Offense count: 30
# Configuration parameters: AllowSafeAssignment. # Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition: Lint/AssignmentInCondition:
Enabled: false Enabled: false
@ -26,7 +26,7 @@ Lint/HandleExceptions:
Lint/ParenthesesAsGroupedExpression: Lint/ParenthesesAsGroupedExpression:
Enabled: false Enabled: false
# Offense count: 646 # Offense count: 669
Metrics/AbcSize: Metrics/AbcSize:
Max: 277 Max: 277
@ -39,26 +39,31 @@ Metrics/BlockNesting:
Metrics/ClassLength: Metrics/ClassLength:
Max: 1653 Max: 1653
# Offense count: 68 # Offense count: 67
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Max: 20 Max: 20
# Offense count: 2454 # Offense count: 2537
# Configuration parameters: AllowURI, URISchemes. # Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength: Metrics/LineLength:
Max: 694 Max: 694
# Offense count: 601 # Offense count: 623
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/MethodLength: Metrics/MethodLength:
Max: 179 Max: 179
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 126
# Offense count: 4 # Offense count: 4
# Configuration parameters: CountKeywordArgs. # Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists: Metrics/ParameterLists:
Max: 9 Max: 9
# Offense count: 70 # Offense count: 69
Metrics/PerceivedComplexity: Metrics/PerceivedComplexity:
Max: 23 Max: 23
@ -67,7 +72,7 @@ Metrics/PerceivedComplexity:
Rails/HasAndBelongsToMany: Rails/HasAndBelongsToMany:
Enabled: false Enabled: false
# Offense count: 70 # Offense count: 67
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
Rails/TimeZone: Rails/TimeZone:
Enabled: false Enabled: false
@ -80,11 +85,11 @@ Style/AccessorMethodName:
Style/AsciiComments: Style/AsciiComments:
Enabled: false Enabled: false
# Offense count: 307 # Offense count: 308
Style/Documentation: Style/Documentation:
Enabled: false Enabled: false
# Offense count: 39 # Offense count: 38
# Configuration parameters: MinBodyLength. # Configuration parameters: MinBodyLength.
Style/GuardClause: Style/GuardClause:
Enabled: false Enabled: false
@ -99,7 +104,7 @@ Style/LineEndConcatenation:
Style/NumericLiterals: Style/NumericLiterals:
MinDigits: 11 MinDigits: 11
# Offense count: 41 # Offense count: 42
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/PerlBackrefs: Style/PerlBackrefs:
Enabled: false Enabled: false

View file

@ -95,8 +95,10 @@ class ChangesetController < ApplicationController
lat << cs.max_lat unless cs.max_lat.nil? lat << cs.max_lat unless cs.max_lat.nil?
# collapse the arrays to minimum and maximum # collapse the arrays to minimum and maximum
cs.min_lon, cs.min_lat, cs.max_lon, cs.max_lat = cs.min_lon = lon.min
lon.min, lat.min, lon.max, lat.max 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 # save the larger bounding box and return the changeset, which
# will include the bigger bounding box. # will include the bigger bounding box.

View file

@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application. # 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 run Rails.application

View file

@ -99,7 +99,8 @@ module ActionView
window_pages = current_page.window(options[:window_size]).pages window_pages = current_page.window(options[:window_size]).pages
return if window_pages.length <= 1 unless link_to_current_page return if window_pages.length <= 1 unless link_to_current_page
first, last = paginator.first, paginator.last first = paginator.first
last = paginator.last
html = "" html = ""

View file

@ -124,8 +124,7 @@ class DiffReader
# an exception subclassing OSM::APIError will be thrown. # an exception subclassing OSM::APIError will be thrown.
def commit def commit
# data structure used for mapping placeholder IDs to real IDs # data structure used for mapping placeholder IDs to real IDs
node_ids, way_ids, rel_ids = {}, {}, {} ids = { :node => {}, :way => {}, :relation => {} }
ids = { :node => node_ids, :way => way_ids, :relation => rel_ids }
# take the first element and check that it is an osmChange element # take the first element and check that it is an osmChange element
@reader.read @reader.read

View file

@ -63,7 +63,8 @@ module OSM
# Raised when to delete an already-deleted object. # Raised when to delete an already-deleted object.
class APIAlreadyDeletedError < APIError class APIAlreadyDeletedError < APIError
def initialize(object = "object", object_id = "") def initialize(object = "object", object_id = "")
@object, @object_id = object, object_id @object = object
@object_id = object_id
end end
attr_reader :object, :object_id attr_reader :object, :object_id
@ -171,7 +172,8 @@ module OSM
# the changeset ID that the diff was uploaded to. # the changeset ID that the diff was uploaded to.
class APIChangesetMismatchError < APIError class APIChangesetMismatchError < APIError
def initialize(provided, allowed) def initialize(provided, allowed)
@provided, @allowed = provided, allowed @provided = provided
@allowed = allowed
end end
def status def status
@ -203,7 +205,9 @@ module OSM
# they should. # they should.
class APIBadXMLError < APIError class APIBadXMLError < APIError
def initialize(model, xml, message = "") def initialize(model, xml, message = "")
@model, @xml, @message = model, xml, message @model = model
@xml = xml
@message = message
end end
def status def status
@ -218,7 +222,10 @@ module OSM
# Raised when the provided version is not equal to the latest in the db. # Raised when the provided version is not equal to the latest in the db.
class APIVersionMismatchError < APIError class APIVersionMismatchError < APIError
def initialize(id, type, provided, latest) def initialize(id, type, provided, latest)
@id, @type, @provided, @latest = id, type, provided, latest @id = id
@type = type
@provided = provided
@latest = latest
end end
attr_reader :provided, :latest, :id, :type attr_reader :provided, :latest, :id, :type
@ -236,7 +243,9 @@ module OSM
# this is now forbidden by the API. # this is now forbidden by the API.
class APIDuplicateTagsError < APIError class APIDuplicateTagsError < APIError
def initialize(type, id, tag_key) def initialize(type, id, tag_key)
@type, @id, @tag_key = type, id, tag_key @type = type
@id = id
@tag_key = tag_key
end end
attr_reader :type, :id, :tag_key attr_reader :type, :id, :tag_key
@ -254,7 +263,9 @@ module OSM
# This prevents ways from being to long and difficult to work with # This prevents ways from being to long and difficult to work with
class APITooManyWayNodesError < APIError class APITooManyWayNodesError < APIError
def initialize(id, provided, max) def initialize(id, provided, max)
@id, @provided, @max = id, provided, max @id = id
@provided = provided
@max = max
end end
attr_reader :id, :provided, :max attr_reader :id, :provided, :max