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`
# 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

View file

@ -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.

View file

@ -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

View file

@ -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 = ""

View file

@ -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

View file

@ -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