Skip to content

Commit

Permalink
Style/NegatedIfElseCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
CloCkWeRX committed Jul 13, 2024
1 parent 3eb08f9 commit a5fe87a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 0 additions & 6 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ Style/FrozenStringLiteralComment:
- 'test/models.rb'
- 'test/schema.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/NegatedIfElseCondition:
Exclude:
- 'lib/commentable_methods.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantDoubleSplatHashBraces:
Expand Down
6 changes: 3 additions & 3 deletions lib/commentable_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def acts_as_commentable(*args)
class_attribute :comment_types
self.comment_types = (comment_roles.blank? ? [:comments] : comment_roles)

if !comment_roles.blank?
if comment_roles.blank?
has_many :comments, **{ as: :commentable, dependent: :destroy }.merge(join_options)
else
comment_roles.each do |role|
define_role_based_inflection(role)
end
has_many :all_comments, **{ as: :commentable, dependent: :destroy, class_name: 'Comment' }.merge(join_options)
else
has_many :comments, **{ as: :commentable, dependent: :destroy }.merge(join_options)
end

comment_types.each do |role|
Expand Down

0 comments on commit a5fe87a

Please sign in to comment.