From 93a2ebd46f5dcc8c46c28458d2a1e8d1ad51bfc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 28 Sep 2019 22:35:34 +0200 Subject: [PATCH] Add and apply DuplicateMethods rubocop rule These methods were defined with `attr_reader` (or accessor in some cases) and then they were redefined. --- .rubocop_basic.yml | 3 +++ app/models/budget/result.rb | 2 +- lib/comment_tree.rb | 2 +- lib/email_digest.rb | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index d9643ff25..71f369571 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -120,6 +120,9 @@ Layout/TrailingWhitespace: Lint/AmbiguousRegexpLiteral: Enabled: true +Lint/DuplicateMethods: + Enabled: true + Lint/LiteralAsCondition: Enabled: true diff --git a/app/models/budget/result.rb b/app/models/budget/result.rb index d034e50ef..b28e7b2a9 100644 --- a/app/models/budget/result.rb +++ b/app/models/budget/result.rb @@ -1,7 +1,7 @@ class Budget class Result - attr_accessor :budget, :heading, :money_spent, :current_investment + attr_accessor :budget, :heading, :current_investment def initialize(budget, heading) @budget = budget diff --git a/lib/comment_tree.rb b/lib/comment_tree.rb index eedb64d96..b06eee833 100644 --- a/lib/comment_tree.rb +++ b/lib/comment_tree.rb @@ -2,7 +2,7 @@ class CommentTree 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) @commentable = commentable diff --git a/lib/email_digest.rb b/lib/email_digest.rb index 55bb62600..55cc65ae3 100644 --- a/lib/email_digest.rb +++ b/lib/email_digest.rb @@ -1,6 +1,6 @@ class EmailDigest - attr_accessor :user, :notifications + attr_accessor :user def initialize(user) @user = user