# This configuration was generated by
# `rubocop --auto-gen-config`
- # on 2021-12-28 19:44:27 UTC using RuboCop version 1.24.0.
+ # on 2022-02-23 19:11:04 UTC using RuboCop version 1.25.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-rails
- rubocop-rake
- # Offense count: 544
+ # Offense count: 550
# Cop supports --auto-correct.
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
- 'app/controllers/geocoder_controller.rb'
- 'app/helpers/browse_tags_helper.rb'
- # Offense count: 663
+ # Offense count: 665
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 189
- # Offense count: 72
+ # Offense count: 73
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# IgnoredMethods: refine
Metrics/BlockLength:
Metrics/ClassLength:
Max: 313
- # Offense count: 57
+ # Offense count: 58
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 25
- # Offense count: 739
+ # Offense count: 742
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
Metrics/MethodLength:
Max: 179
Metrics/PerceivedComplexity:
Max: 26
- # Offense count: 549
+ # Offense count: 550
Minitest/MultipleAssertions:
Max: 52
Exclude:
- 'app/helpers/title_helper.rb'
- # Offense count: 1
+ # Offense count: 16
+ # Configuration parameters: IgnoreScopes, Include.
+ # Include: app/models/**/*.rb
+ Rails/InverseOf:
+ Exclude:
+ - 'app/models/changeset.rb'
+ - 'app/models/diary_entry.rb'
+ - 'app/models/friendship.rb'
+ - 'app/models/issue.rb'
+ - 'app/models/message.rb'
+ - 'app/models/note.rb'
+ - 'app/models/user.rb'
+
+ # Offense count: 2
# Configuration parameters: Include.
# Include: app/controllers/**/*.rb
Rails/LexicallyScopedActionFilter:
- 'lib/rich_text.rb'
- 'test/helpers/application_helper_test.rb'
-# Offense count: 26
-# Cop supports --auto-correct.
-Rails/RedundantPresenceValidationOnBelongsTo:
- Enabled: false
-
-# Offense count: 90
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: strict, flexible
-Rails/TimeZone:
- Enabled: false
-
# Offense count: 6
# Cop supports --auto-correct.
Rake/Desc:
- 'lib/tasks/subscribe_diary_authors.rake'
- 'lib/tasks/subscribe_old_changesets.rake'
- # Offense count: 609
+ # Offense count: 617
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
belongs_to :changeset
- has_many :old_nodes, -> { order(:version) }
+ has_many :old_nodes, -> { order(:version) }, :inverse_of => :current_node
has_many :way_nodes
has_many :ways, :through => :way_nodes
:numericality => { :on => :update, :only_integer => true }
validates :version, :presence => true,
:numericality => { :only_integer => true }
- validates :changeset_id, :presence => true,
- :numericality => { :only_integer => true }
validates :latitude, :presence => true,
:numericality => { :only_integer => true }
validates :longitude, :presence => true,
private
def save_with_history!
- t = Time.now.getutc
+ t = Time.now.utc
self.version += 1
self.timestamp = t
include GeoRecord
has_many :comments, -> { left_joins(:author).where(:visible => true, :users => { :status => [nil, "active", "confirmed"] }).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id
- has_many :all_comments, -> { left_joins(:author).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id
+ has_many :all_comments, -> { left_joins(:author).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id, :inverse_of => :note
validates :id, :uniqueness => true, :presence => { :on => :update },
:numericality => { :on => :update, :only_integer => true }
# Close a note
def close
self.status = "closed"
- self.closed_at = Time.now.getutc
+ self.closed_at = Time.now.utc
save
end
# the queries generated by Redactable will use the wrong table name.
include Redactable
- validates :changeset, :presence => true, :associated => true
+ validates :changeset, :associated => true
validates :latitude, :presence => true,
:numericality => { :only_integer => true }
validates :longitude, :presence => true,
validate :validate_position
belongs_to :changeset
- belongs_to :redaction
+ belongs_to :redaction, :optional => true
- belongs_to :current_node, :class_name => "Node", :foreign_key => "node_id"
+ belongs_to :current_node, :class_name => "Node", :foreign_key => "node_id", :inverse_of => :old_nodes
- has_many :old_tags, :class_name => "OldNodeTag", :foreign_key => [:node_id, :version]
+ has_many :old_tags, :class_name => "OldNodeTag", :foreign_key => [:node_id, :version], :inverse_of => :old_node
def validate_position
errors.add(:base, "Node is not in the world") unless in_world?
self.table_name = "node_tags"
self.primary_keys = "node_id", "version", "k"
- belongs_to :old_node, :foreign_key => [:node_id, :version]
+ belongs_to :old_node, :foreign_key => [:node_id, :version], :inverse_of => :old_tags
- validates :old_node, :presence => true, :associated => true
+ validates :old_node, :associated => true
validates :k, :v, :allow_blank => true, :length => { :maximum => 255 }, :characters => true
validates :k, :uniqueness => { :scope => [:node_id, :version] }
end
include Redactable
belongs_to :changeset
- belongs_to :redaction
+ belongs_to :redaction, :optional => true
- belongs_to :current_relation, :class_name => "Relation", :foreign_key => "relation_id"
+ belongs_to :current_relation, :class_name => "Relation", :foreign_key => "relation_id", :inverse_of => :old_relations
- has_many :old_members, -> { order(:sequence_id) }, :class_name => "OldRelationMember", :foreign_key => [:relation_id, :version]
- has_many :old_tags, :class_name => "OldRelationTag", :foreign_key => [:relation_id, :version]
+ has_many :old_members, -> { order(:sequence_id) }, :class_name => "OldRelationMember", :foreign_key => [:relation_id, :version], :inverse_of => :old_relation
+ has_many :old_tags, :class_name => "OldRelationTag", :foreign_key => [:relation_id, :version], :inverse_of => :old_relation
- validates :changeset, :presence => true, :associated => true
+ validates :changeset, :associated => true
validates :timestamp, :presence => true
validates :visible, :inclusion => [true, false]
self.table_name = "relation_tags"
self.primary_keys = "relation_id", "version", "k"
- belongs_to :old_relation, :foreign_key => [:relation_id, :version]
+ belongs_to :old_relation, :foreign_key => [:relation_id, :version], :inverse_of => :old_tags
- validates :old_relation, :presence => true, :associated => true
+ validates :old_relation, :associated => true
validates :k, :v, :allow_blank => true, :length => { :maximum => 255 }, :characters => true
validates :k, :uniqueness => { :scope => [:relation_id, :version] }
end
include Redactable
belongs_to :changeset
- belongs_to :redaction
+ belongs_to :redaction, :optional => true
- belongs_to :current_way, :class_name => "Way", :foreign_key => "way_id"
+ belongs_to :current_way, :class_name => "Way", :foreign_key => "way_id", :inverse_of => :old_ways
- has_many :old_nodes, :class_name => "OldWayNode", :foreign_key => [:way_id, :version]
- has_many :old_tags, :class_name => "OldWayTag", :foreign_key => [:way_id, :version]
+ has_many :old_nodes, :class_name => "OldWayNode", :foreign_key => [:way_id, :version], :inverse_of => :old_way
+ has_many :old_tags, :class_name => "OldWayTag", :foreign_key => [:way_id, :version], :inverse_of => :old_way
- validates :changeset, :presence => true, :associated => true
+ validates :changeset, :associated => true
validates :timestamp, :presence => true
validates :visible, :inclusion => [true, false]
self.table_name = "way_tags"
self.primary_keys = "way_id", "version", "k"
- belongs_to :old_way, :foreign_key => [:way_id, :version]
+ belongs_to :old_way, :foreign_key => [:way_id, :version], :inverse_of => :old_tags
- validates :old_way, :presence => true, :associated => true
+ validates :old_way, :associated => true
validates :k, :v, :allow_blank => true, :length => { :maximum => 255 }, :characters => true
validates :k, :uniqueness => { :scope => [:way_id, :version] }
end
belongs_to :changeset
- has_many :old_relations, -> { order(:version) }
+ has_many :old_relations, -> { order(:version) }, :inverse_of => :current_relation
- has_many :relation_members, -> { order(:sequence_id) }
+ has_many :relation_members, -> { order(:sequence_id) }, :inverse_of => :relation
has_many :relation_tags
has_many :containing_relation_members, :class_name => "RelationMember", :as => :member
:numericality => { :on => :update, :only_integer => true }
validates :version, :presence => true,
:numericality => { :only_integer => true }
- validates :changeset_id, :presence => true,
- :numericality => { :only_integer => true }
validates :timestamp, :presence => true
validates :changeset, :associated => true
validates :visible, :inclusion => [true, false]
private
def save_with_history!
- t = Time.now.getutc
+ t = Time.now.utc
self.version += 1
self.timestamp = t
belongs_to :changeset
- has_many :old_ways, -> { order(:version) }
+ has_many :old_ways, -> { order(:version) }, :inverse_of => :current_way
- has_many :way_nodes, -> { order(:sequence_id) }
+ has_many :way_nodes, -> { order(:sequence_id) }, :inverse_of => :way
has_many :nodes, :through => :way_nodes
has_many :way_tags
:numericality => { :on => :update, :only_integer => true }
validates :version, :presence => true,
:numericality => { :only_integer => true }
- validates :changeset_id, :presence => true,
- :numericality => { :only_integer => true }
validates :timestamp, :presence => true
validates :changeset, :associated => true
validates :visible, :inclusion => [true, false]
private
def save_with_history!
- t = Time.now.getutc
+ t = Time.now.utc
self.version += 1
self.timestamp = t