# This configuration was generated by
# `rubocop --auto-gen-config`
-# on 2020-09-02 06:16:56 UTC using RuboCop version 0.90.0.
+# on 2021-01-11 19:00:54 UTC using RuboCop version 1.8.1.
# 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
- rubocop-performance
- rubocop-rails
-# Offense count: 568
+# Offense count: 544
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
- Max: 250
+ Max: 248
# Offense count: 36
# Configuration parameters: AllowSafeAssignment.
- 'lib/osm.rb'
- 'script/deliver-message'
-# Offense count: 682
-# Configuration parameters: IgnoredMethods.
+# Offense count: 8
+# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
+Lint/DuplicateBranch:
+ Exclude:
+ - 'app/controllers/api_controller.rb'
+ - 'app/controllers/diary_entries_controller.rb'
+ - 'app/controllers/geocoder_controller.rb'
+ - 'app/helpers/browse_tags_helper.rb'
+ - 'lib/password_hash.rb'
+
+# Offense count: 487
+# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 194
-# Offense count: 72
-# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
-# ExcludedMethods: refine
+# Offense count: 62
+# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
+# IgnoredMethods: refine
Metrics/BlockLength:
Max: 71
Metrics/BlockNesting:
Max: 5
-# Offense count: 25
+# Offense count: 24
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
- Max: 644
+ Max: 582
-# Offense count: 68
+# Offense count: 52
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 26
-# Offense count: 735
-# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
+# Offense count: 553
+# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
Metrics/MethodLength:
Max: 179
-# Offense count: 4
-# Configuration parameters: CountKeywordArgs.
+# Offense count: 1
+# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
Metrics/ParameterLists:
- Max: 9
+ Max: 6
-# Offense count: 69
+# Offense count: 56
# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 26
-# Offense count: 540
+# Offense count: 365
Minitest/MultipleAssertions:
Max: 81
-# Offense count: 6
+# Offense count: 4
Naming/AccessorMethodName:
Exclude:
- 'app/controllers/application_controller.rb'
- 'app/helpers/title_helper.rb'
- - 'app/models/old_way.rb'
- 'lib/osm.rb'
# Offense count: 8
# MethodDefinitionMacros: define_method, define_singleton_method
Naming/PredicateName:
Exclude:
- - 'spec/**/*'
- 'app/models/changeset.rb'
- 'app/models/old_node.rb'
- 'app/models/old_relation.rb'
- 'app/models/changeset.rb'
- 'app/models/user.rb'
-# Offense count: 4
+# Offense count: 3
# Configuration parameters: Include.
# Include: app/helpers/**/*.rb
Rails/HelperInstanceVariable:
- 'db/migrate/025_add_end_time_to_changesets.rb'
- 'db/migrate/20120404205604_add_user_and_description_to_redaction.rb'
-# Offense count: 19
+# Offense count: 8
Rails/OutputSafety:
Exclude:
- 'app/controllers/users_controller.rb'
- 'lib/rich_text.rb'
- 'test/helpers/application_helper_test.rb'
-# Offense count: 95
+# Offense count: 80
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, flexible
Rails/TimeZone:
Enabled: false
-# Offense count: 572
+# Offense count: 558
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false
-# Offense count: 78
+# Offense count: 54
# Cop supports --auto-correct.
# Configuration parameters: Strict.
Style/NumericLiterals:
- MinDigits: 11
+ MinDigits: 15
end
# stupid Time seems to throw both of these for bad parsing, so
# we have to catch both and ensure the correct code path is taken.
- rescue ArgumentError => e
- raise OSM::APIBadUserInput, e.message.to_s
- rescue RuntimeError => e
+ rescue ArgumentError, RuntimeError => e
raise OSM::APIBadUserInput, e.message.to_s
end
def nsew_to_decdeg(captures)
begin
Float(captures[0])
- lat = !captures[2].casecmp("s").zero? ? captures[0].to_f : -captures[0].to_f
- lon = !captures[5].casecmp("w").zero? ? captures[3].to_f : -captures[3].to_f
+ lat = captures[2].casecmp("s").zero? ? -captures[0].to_f : captures[0].to_f
+ lon = captures[5].casecmp("w").zero? ? -captures[3].to_f : captures[3].to_f
rescue StandardError
- lat = !captures[0].casecmp("s").zero? ? captures[1].to_f : -captures[1].to_f
- lon = !captures[3].casecmp("w").zero? ? captures[4].to_f : -captures[4].to_f
+ lat = captures[0].casecmp("s").zero? ? -captures[1].to_f : captures[1].to_f
+ lon = captures[3].casecmp("w").zero? ? -captures[4].to_f : captures[4].to_f
end
{ :lat => lat, :lon => lon }
end
def ddm_to_decdeg(captures)
begin
Float(captures[0])
- lat = !captures[3].casecmp("s").zero? ? captures[0].to_f + captures[1].to_f / 60 : -(captures[0].to_f + captures[1].to_f / 60)
- lon = !captures[7].casecmp("w").zero? ? captures[4].to_f + captures[5].to_f / 60 : -(captures[4].to_f + captures[5].to_f / 60)
+ lat = captures[3].casecmp("s").zero? ? -(captures[0].to_f + captures[1].to_f / 60) : captures[0].to_f + captures[1].to_f / 60
+ lon = captures[7].casecmp("w").zero? ? -(captures[4].to_f + captures[5].to_f / 60) : captures[4].to_f + captures[5].to_f / 60
rescue StandardError
- lat = !captures[0].casecmp("s").zero? ? captures[1].to_f + captures[2].to_f / 60 : -(captures[1].to_f + captures[2].to_f / 60)
- lon = !captures[4].casecmp("w").zero? ? captures[5].to_f + captures[6].to_f / 60 : -(captures[5].to_f + captures[6].to_f / 60)
+ lat = captures[0].casecmp("s").zero? ? -(captures[1].to_f + captures[2].to_f / 60) : captures[1].to_f + captures[2].to_f / 60
+ lon = captures[4].casecmp("w").zero? ? -(captures[5].to_f + captures[6].to_f / 60) : captures[5].to_f + captures[6].to_f / 60
end
{ :lat => lat, :lon => lon }
end
def dms_to_decdeg(captures)
begin
Float(captures[0])
- lat = !captures[4].casecmp("s").zero? ? captures[0].to_f + (captures[1].to_f + captures[2].to_f / 60) / 60 : -(captures[0].to_f + (captures[1].to_f + captures[2].to_f / 60) / 60)
- lon = !captures[9].casecmp("w").zero? ? captures[5].to_f + (captures[6].to_f + captures[7].to_f / 60) / 60 : -(captures[5].to_f + (captures[6].to_f + captures[7].to_f / 60) / 60)
+ lat = captures[4].casecmp("s").zero? ? -(captures[0].to_f + (captures[1].to_f + captures[2].to_f / 60) / 60) : captures[0].to_f + (captures[1].to_f + captures[2].to_f / 60) / 60
+ lon = captures[9].casecmp("w").zero? ? -(captures[5].to_f + (captures[6].to_f + captures[7].to_f / 60) / 60) : captures[5].to_f + (captures[6].to_f + captures[7].to_f / 60) / 60
rescue StandardError
- lat = !captures[0].casecmp("s").zero? ? captures[1].to_f + (captures[2].to_f + captures[3].to_f / 60) / 60 : -(captures[1].to_f + (captures[2].to_f + captures[3].to_f / 60) / 60)
- lon = !captures[5].casecmp("w").zero? ? captures[6].to_f + (captures[7].to_f + captures[8].to_f / 60) / 60 : -(captures[6].to_f + (captures[7].to_f + captures[8].to_f / 60) / 60)
+ lat = captures[0].casecmp("s").zero? ? -(captures[1].to_f + (captures[2].to_f + captures[3].to_f / 60) / 60) : captures[1].to_f + (captures[2].to_f + captures[3].to_f / 60) / 60
+ lon = captures[5].casecmp("w").zero? ? -(captures[6].to_f + (captures[7].to_f + captures[8].to_f / 60) / 60) : captures[6].to_f + (captures[7].to_f + captures[8].to_f / 60) / 60
end
{ :lat => lat, :lon => lon }
end
@redaction.user = current_user
@redaction.title = params[:redaction][:title]
@redaction.description = params[:redaction][:description]
- # note that the description format will default to 'markdown'
+ # NOTE: the description format will default to 'markdown'
if @redaction.save
flash[:notice] = t(".flash")
def edit; end
def update
- # note - don't update the user ID
+ # NOTE: don't update the user ID
@redaction.title = params[:redaction][:title]
@redaction.description = params[:redaction][:description]
self.table_name = "nodes"
self.primary_keys = "node_id", "version"
- # note this needs to be included after the table name changes, or
+ # NOTE: this needs to be included after the table name changes, or
# the queries generated by Redactable will use the wrong table name.
include Redactable
self.table_name = "relations"
self.primary_keys = "relation_id", "version"
- # note this needs to be included after the table name changes, or
+ # NOTE: this needs to be included after the table name changes, or
# the queries generated by Redactable will use the wrong table name.
include Redactable
self.table_name = "ways"
self.primary_keys = "way_id", "version"
- # note this needs to be included after the table name changes, or
+ # NOTE: this needs to be included after the table name changes, or
# the queries generated by Redactable will use the wrong table name.
include Redactable
def self.categories_for(reportable)
case reportable.class.name
- when "DiaryEntry" then %w[spam offensive threat other]
- when "DiaryComment" then %w[spam offensive threat other]
+ when "DiaryEntry", "DiaryComment" then %w[spam offensive threat other]
when "User" then %w[spam offensive threat vandal other]
when "Note" then %w[spam personal abusive other]
else %w[other]
<% changeset = contact.changesets.first %>
<% if changeset %>
<%= t("users.show.latest edit", :ago => time_ago_in_words(changeset.created_at, :scope => :'datetime.distance_in_words_ago')) %>
- <% comment = changeset.tags["comment"].to_s != "" ? changeset.tags["comment"] : t("browse.no_comment") %>
+ <% comment = changeset.tags["comment"].to_s == "" ? t("browse.no_comment") : changeset.tags["comment"] %>
<q><%= link_to(comment,
{ :controller => "browse", :action => "changeset", :id => changeset.id },
{ :title => t("changesets.changeset.view_changeset_details") }) %></q>
module ClassMethods
def included(controller)
controller.class_eval do
- def self.before_filter(*names, &blk)
- before_action(*names, &blk)
+ def self.before_filter(...)
+ before_action(...)
end
- def self.skip_before_filter(*names, &blk)
- skip_before_action(*names, &blk)
+ def self.skip_before_filter(...)
+ skip_before_action(...)
end
end
-StrongMigrations.start_after = 20190518115041 # rubocop:disable Style/NumericLiterals
+StrongMigrations.start_after = 20190518115041
puts "<p><em>Exception: #{e}</em><br />#{e.backtrace.join('<br />')}</p>"
end
-puts "<p>Report took #{(Time.new - start_time)} seconds to run</p>"
+puts "<p>Report took #{Time.new - start_time} seconds to run</p>"
puts "</body>"
puts "</html>"
assert_equal "The parameter bbox is required, and must be of the form min_lon,min_lat,max_lon,max_lat", @response.body, "A bbox param was expected"
end
- def test_traces_page_less_than_0
+ def test_traces_page_less_than_zero
-10.upto(-1) do |i|
get trackpoints_path(:page => i, :bbox => "-0.1,-0.1,0.1,0.1")
assert_response :bad_request
assert_select "li.search_results_entry", results.count
results.each do |result|
- attrs = result.collect { |k, v| "[data-#{k}='#{v}']" }.join("")
+ attrs = result.collect { |k, v| "[data-#{k}='#{v}']" }.join
assert_select "li.search_results_entry a.set_position#{attrs}", result[:name]
end
end
assert_response :success
assert_template "index"
- if !traces.empty?
+ if traces.empty?
+ assert_select "h4", /Nothing here yet/
+ else
assert_select "table#trace_list tbody", :count => 1 do
assert_select "tr", :count => traces.length do |rows|
traces.zip(rows).each do |trace, row|
end
end
end
- else
- assert_select "h4", /Nothing here yet/
end
end
FactoryBot.define do
- factory :diary_entry_subscription do
- end
+ factory :diary_entry_subscription
end