Add and apply DuplicateMethods rubocop rule

These methods were defined with `attr_reader` (or accessor in some
cases) and then they were redefined.
This commit is contained in:
Javi Martín
2019-09-28 22:35:34 +02:00
parent 6ffe563264
commit 93a2ebd46f
4 changed files with 6 additions and 3 deletions

View File

@@ -120,6 +120,9 @@ Layout/TrailingWhitespace:
Lint/AmbiguousRegexpLiteral: Lint/AmbiguousRegexpLiteral:
Enabled: true Enabled: true
Lint/DuplicateMethods:
Enabled: true
Lint/LiteralAsCondition: Lint/LiteralAsCondition:
Enabled: true Enabled: true

View File

@@ -1,7 +1,7 @@
class Budget class Budget
class Result class Result
attr_accessor :budget, :heading, :money_spent, :current_investment attr_accessor :budget, :heading, :current_investment
def initialize(budget, heading) def initialize(budget, heading)
@budget = budget @budget = budget

View File

@@ -2,7 +2,7 @@ class CommentTree
ROOT_COMMENTS_PER_PAGE = 10 ROOT_COMMENTS_PER_PAGE = 10
attr_reader :root_comments, :commentable, :page, :order attr_reader :commentable, :page, :order
def initialize(commentable, page, order = "confidence_score", valuations: false) def initialize(commentable, page, order = "confidence_score", valuations: false)
@commentable = commentable @commentable = commentable

View File

@@ -1,6 +1,6 @@
class EmailDigest class EmailDigest
attr_accessor :user, :notifications attr_accessor :user
def initialize(user) def initialize(user)
@user = user @user = user