Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix Lint/DuplicateMethods (#24746)

Jarek Radosz138bf486d344
diff --git a/app/models/about.rb b/app/models/about.rb
index 6deb4ff4f4f..4a1821d1c0a 100644
--- a/app/models/about.rb
+++ b/app/models/about.rb
@@ -18,8 +18,6 @@ class About
include ActiveModel::Serialization
include StatsCacheable
- attr_accessor :moderators, :admins
-
def self.stats_cache_key
"about-stats"
end
diff --git a/app/models/email_style.rb b/app/models/email_style.rb
index 88b4b7692ad..4035584ae2d 100644
--- a/app/models/email_style.rb
+++ b/app/models/email_style.rb
@@ -3,8 +3,6 @@
class EmailStyle
include ActiveModel::Serialization
- attr_accessor :html, :css, :default_html, :default_css
-
def id
"email-style"
end
diff --git a/app/models/report.rb b/app/models/report.rb
index 1a29f284fab..e53f0cfedae 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -76,8 +76,6 @@ class Report
:icon,
:modes,
:prev_data,
- :prev_start_date,
- :prev_end_date,
:dates_filtering,
:error,
:primary_color,
diff --git a/app/models/search_log.rb b/app/models/search_log.rb
index 8d4e1d7e7e6..b87231d63fa 100644
--- a/app/models/search_log.rb
+++ b/app/models/search_log.rb
@@ -5,8 +5,6 @@ class SearchLog < ActiveRecord::Base
belongs_to :user
- attr_reader :ctr
-
def ctr
return 0 if click_through == 0 || searches == 0
diff --git a/app/models/tag_group.rb b/app/models/tag_group.rb
index 802ab651ac2..d00fb9eb055 100644
--- a/app/models/tag_group.rb
+++ b/app/models/tag_group.rb
@@ -22,7 +22,7 @@ class TagGroup < ActiveRecord::Base
after_commit { DiscourseTagging.clear_cache! }
- attr_accessor :permissions
+ attr_reader :permissions
def tag_names=(tag_names_arg)
DiscourseTagging.add_or_create_tags_by_name(self, tag_names_arg, unlimited: true)
diff --git a/app/models/topic_list.rb b/app/models/topic_list.rb
index 6061747eee5..a9771d1181d 100644
--- a/app/models/topic_list.rb
+++ b/app/models/topic_list.rb
@@ -40,7 +40,6 @@ class TopicList
:filter,
:for_period,
:per_page,
- :top_tags,
:current_user,
:tags,
:shared_drafts,
diff --git a/app/models/trust_level3_requirements.rb b/app/models/trust_level3_requirements.rb
index 8c2889d6fa7..02960f833d8 100644
--- a/app/models/trust_level3_requirements.rb
+++ b/app/models/trust_level3_requirements.rb
@@ -26,33 +26,6 @@ class TrustLevel3Requirements
LOW_WATER_MARK = 0.9
FORGIVENESS_PERIOD = 6.months
- attr_accessor :days_visited,
- :min_days_visited,
- :num_topics_replied_to,
- :min_topics_replied_to,
- :topics_viewed,
- :min_topics_viewed,
- :posts_read,
- :min_posts_read,
- :topics_viewed_all_time,
- :min_topics_viewed_all_time,
- :posts_read_all_time,
- :min_posts_read_all_time,
- :num_flagged_posts,
- :max_flagged_posts,
- :num_likes_given,
- :min_likes_given,
- :num_likes_received,
- :min_likes_received,
- :num_likes_received,
- :min_likes_received,
- :num_likes_received_days,
- :min_likes_received_days,
- :num_likes_received_users,
- :min_likes_received_users,
- :trust_level_locked,
- :on_grace_period
-
def initialize(user)
@user = user
end
diff --git a/app/serializers/user_post_bookmark_serializer.rb b/app/serializers/user_post_bookmark_serializer.rb
index a9b32aad7e4..94a775a6988 100644
--- a/app/serializers/user_post_bookmark_serializer.rb
+++ b/app/serializers/user_post_bookmark_serializer.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true
class UserPostBookmarkSerializer < UserPostTopicBookmarkBaseSerializer
- attr_reader :post_id
-
def post_id
post.id
end
diff --git a/lib/has_errors.rb b/lib/has_errors.rb
index daa8bb8e8d3..bd50e403f45 100644
--- a/lib/has_errors.rb
+++ b/lib/has_errors.rb
@@ -3,7 +3,6 @@
# Helper functions for dealing with errors and objects that have
# child objects with errors
module HasErrors
- attr_reader :errors
attr_accessor :forbidden, :not_found, :conflict
def errors
diff --git a/lib/import_export/base_exporter.rb b/lib/import_export/base_exporter.rb
index 2effbd2d9fe..640278ceacd 100644
--- a/lib/import_export/base_exporter.rb
+++ b/lib/import_export/base_exporter.rb
@@ -2,7 +2,7 @@
module ImportExport
class BaseExporter
- attr_reader :export_data, :categories
+ attr_reader :export_data
CATEGORY_ATTRS = %i[
id
diff --git a/plugins/chat/app/serializers/chat/user_message_bookmark_serializer.rb b/plugins/chat/app/serializers/chat/user_message_bookmark_serializer.rb
index f1ba24bdc16..716dfd67be3 100644
--- a/plugins/chat/app/serializers/chat/user_message_bookmark_serializer.rb
+++ b/plugins/chat/app/serializers/chat/user_message_bookmark_serializer.rb
@@ -2,8 +2,6 @@
module Chat
class UserMessageBookmarkSerializer < UserBookmarkBaseSerializer
- attr_reader :chat_message
-
def title
fancy_title
end
diff --git a/plugins/chat/spec/system/page_objects/chat/components/messages.rb b/plugins/chat/spec/system/page_objects/chat/components/messages.rb
index a72fe146711..24f6472d73b 100644
--- a/plugins/chat/spec/system/page_objects/chat/components/messages.rb
+++ b/plugins/chat/spec/system/page_objects/chat/components/messages.rb
@@ -16,10 +16,6 @@ module PageObjects
page.find(context)
end
- def flag(message)
- find(message).secondary_action("flag")
- end
-
def copy_link(message)
find(message).secondary_action("copyLink")
end
diff --git a/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb b/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb
index 7811a68d49a..47f37c810fe 100644
--- a/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb
+++ b/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb
@@ -43,10 +43,6 @@ module PageObjects
".chat-thread-list-item__last-reply-timestamp .relative-date[data-time='#{(last_reply.created_at.iso8601.to_time.to_f * 1000).to_i}']"
end
- def has_no_unread_item?(id)
- component.has_no_css?(item_by_id_selector(id) + ".-is-unread")
- end
-
def has_unread_item?(id, count: nil)
if count.nil?
component.has_css?(item_by_id_selector(id) + ".-is-unread")
diff --git a/plugins/chat/spec/system/page_objects/sidebar/sidebar.rb b/plugins/chat/spec/system/page_objects/sidebar/sidebar.rb
index 448c9e5b0b1..3d4bc229250 100644
--- a/plugins/chat/spec/system/page_objects/sidebar/sidebar.rb
+++ b/plugins/chat/spec/system/page_objects/sidebar/sidebar.rb
@@ -14,10 +14,6 @@ module PageObjects
find(PUBLIC_CHANNELS_SECTION_SELECTOR)
end
- def channels_section
- find(PUBLIC_CHANNELS_SECTION_SELECTOR)
- end
-
def dms_section
find(DM_CHANNELS_SECTION_SELECTOR)
end
diff --git a/spec/support/fake_logger.rb b/spec/support/fake_logger.rb
index 376aab4c8c8..15c1a9e5f32 100644
--- a/spec/support/fake_logger.rb
+++ b/spec/support/fake_logger.rb
@@ -1,11 +1,11 @@
# frozen_string_literal: true
class FakeLogger
- attr_reader :debug, :infos, :warnings, :errors, :fatals
+ attr_reader :debugs, :infos, :warnings, :errors, :fatals
attr_accessor :level
def initialize
- @debug = []
+ @debugs = []
@infos = []
@warnings = []
@errors = []
@@ -14,7 +14,7 @@ class FakeLogger
end
def debug(message)
- @debug << message
+ @debugs << message
end
def debug?
diff --git a/spec/system/page_objects/modals/sidebar_edit_categories.rb b/spec/system/page_objects/modals/sidebar_edit_categories.rb
index 56d96472175..2b132eca2bb 100644
--- a/spec/system/page_objects/modals/sidebar_edit_categories.rb
+++ b/spec/system/page_objects/modals/sidebar_edit_categories.rb
@@ -39,12 +39,6 @@ module PageObjects
expect(categories.map(&:text)).to eq(category_names)
end
- def has_checkbox?(category, disabled: false)
- has_selector?(
- ".sidebar-categories-form .sidebar-categories-form__category-row[data-category-id='#{category.id}'] .sidebar-categories-form__input#{disabled ? "[disabled]" : ""}",
- )
- end
-
def toggle_category_checkbox(category)
find(
".sidebar-categories-form .sidebar-categories-form__category-row[data-category-id='#{category.id}'] .sidebar-categories-form__input",