Fix rubocop warnings
This commit is contained in:
parent
96b1bff9fb
commit
282ff4936c
7 changed files with 37 additions and 22 deletions
|
@ -1,6 +1,8 @@
|
|||
module UserRolesHelper
|
||||
def role_icons(user)
|
||||
UserRole::ALL_ROLES.reduce("".html_safe) { |a, e| a + " " + role_icon(user, e) }
|
||||
UserRole::ALL_ROLES.reduce("".html_safe) do |acc, elem|
|
||||
acc + " " + role_icon(user, elem)
|
||||
end
|
||||
end
|
||||
|
||||
def role_icon(user, role)
|
||||
|
|
|
@ -370,7 +370,7 @@ class Relation < ActiveRecord::Base
|
|||
# materially change the rest of the relation.
|
||||
any_relations =
|
||||
changed_members.collect { |_id, type| type == "relation" }
|
||||
.inject(false) { |a, e| a || e }
|
||||
.inject(false) { |acc, elem| acc || elem }
|
||||
|
||||
update_members = if tags_changed || any_relations
|
||||
# add all non-relation bounding boxes to the changeset
|
||||
|
|
|
@ -216,8 +216,8 @@ class User < ActiveRecord::Base
|
|||
def spam_score
|
||||
changeset_score = changesets.size * 50
|
||||
trace_score = traces.size * 50
|
||||
diary_entry_score = diary_entries.inject(0) { |a, e| a + e.body.spam_score }
|
||||
diary_comment_score = diary_comments.inject(0) { |a, e| a + e.body.spam_score }
|
||||
diary_entry_score = diary_entries.inject(0) { |acc, elem| acc + elem.body.spam_score }
|
||||
diary_comment_score = diary_comments.inject(0) { |acc, elem| acc + elem.body.spam_score }
|
||||
|
||||
score = description.spam_score / 4.0
|
||||
score += diary_entries.where("created_at > ?", 1.day.ago).count * 10
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
Konacha.configure do |config|
|
||||
if defined?(Konacha)
|
||||
Konacha.configure do |config|
|
||||
require "capybara/poltergeist"
|
||||
config.spec_dir = "test/javascripts"
|
||||
config.driver = :poltergeist
|
||||
end if defined?(Konacha)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -43,14 +43,22 @@ class BoundingBox
|
|||
# only try to expand the bbox if there is a value for every coordinate
|
||||
# which there will be from the previous line as long as array does not contain a nil
|
||||
if bbox.complete?
|
||||
if bbox.min_lon < min_lon
|
||||
@min_lon = [-SCALED_LON_LIMIT,
|
||||
bbox.min_lon + margin * (min_lon - max_lon)].max if bbox.min_lon < min_lon
|
||||
bbox.min_lon + margin * (min_lon - max_lon)].max
|
||||
end
|
||||
if bbox.min_lat < min_lat
|
||||
@min_lat = [-SCALED_LAT_LIMIT,
|
||||
bbox.min_lat + margin * (min_lat - max_lat)].max if bbox.min_lat < min_lat
|
||||
bbox.min_lat + margin * (min_lat - max_lat)].max
|
||||
end
|
||||
if bbox.max_lon > max_lon
|
||||
@max_lon = [+SCALED_LON_LIMIT,
|
||||
bbox.max_lon + margin * (max_lon - min_lon)].min if bbox.max_lon > max_lon
|
||||
bbox.max_lon + margin * (max_lon - min_lon)].min
|
||||
end
|
||||
if bbox.max_lat > max_lat
|
||||
@max_lat = [+SCALED_LAT_LIMIT,
|
||||
bbox.max_lat + margin * (max_lat - min_lat)].min if bbox.max_lat > max_lat
|
||||
bbox.max_lat + margin * (max_lat - min_lat)].min
|
||||
end
|
||||
end
|
||||
self
|
||||
end
|
||||
|
|
|
@ -93,9 +93,10 @@ module ActionController
|
|||
valid_options << :actions unless in_action
|
||||
|
||||
unknown_option_keys = options.keys - valid_options
|
||||
unless unknown_option_keys.empty?
|
||||
raise ActionController::ActionControllerError,
|
||||
"Unknown options: #{unknown_option_keys.join(', ')}" unless
|
||||
unknown_option_keys.empty?
|
||||
"Unknown options: #{unknown_option_keys.join(', ')}"
|
||||
end
|
||||
|
||||
options[:singular_name] ||= ActiveSupport::Inflector.singularize(collection_id.to_s)
|
||||
options[:class_name] ||= ActiveSupport::Inflector.camelize(options[:singular_name])
|
||||
|
|
|
@ -85,8 +85,10 @@ class DiffReader
|
|||
def with_model
|
||||
with_element do |model_name, _model_attributes|
|
||||
model = MODELS[model_name]
|
||||
if model.nil?
|
||||
raise OSM::APIBadUserInput.new("Unexpected element type #{model_name}, " +
|
||||
"expected node, way or relation.") if model.nil?
|
||||
"expected node, way or relation.")
|
||||
end
|
||||
# new in libxml-ruby >= 2, expand returns an element not associated
|
||||
# with a document. this means that there's no encoding parameter,
|
||||
# which means basically nothing works.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue