Skip to content

Commit

Permalink
DEV: Fix Lint/DuplicateMethods (discourse#24746)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX authored Dec 6, 2023
1 parent 4280c01 commit 138bf48
Show file tree
Hide file tree
Showing 16 changed files with 5 additions and 64 deletions.
2 changes: 0 additions & 2 deletions app/models/about.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def initialize(category_id, moderators)
include ActiveModel::Serialization
include StatsCacheable

attr_accessor :moderators, :admins

def self.stats_cache_key
"about-stats"
end
Expand Down
2 changes: 0 additions & 2 deletions app/models/email_style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
class EmailStyle
include ActiveModel::Serialization

attr_accessor :html, :css, :default_html, :default_css

def id
"email-style"
end
Expand Down
2 changes: 0 additions & 2 deletions app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ class Report
:icon,
:modes,
:prev_data,
:prev_start_date,
:prev_end_date,
:dates_filtering,
:error,
:primary_color,
Expand Down
2 changes: 0 additions & 2 deletions app/models/search_log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ class SearchLog < ActiveRecord::Base

belongs_to :user

attr_reader :ctr

def ctr
return 0 if click_through == 0 || searches == 0

Expand Down
2 changes: 1 addition & 1 deletion app/models/tag_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion app/models/topic_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def self.preload_user_ids(topics, user_ids, object)
:filter,
:for_period,
:per_page,
:top_tags,
:current_user,
:tags,
:shared_drafts,
Expand Down
27 changes: 0 additions & 27 deletions app/models/trust_level3_requirements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,6 @@ def total
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
Expand Down
2 changes: 0 additions & 2 deletions app/serializers/user_post_bookmark_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

class UserPostBookmarkSerializer < UserPostTopicBookmarkBaseSerializer
attr_reader :post_id

def post_id
post.id
end
Expand Down
1 change: 0 additions & 1 deletion lib/has_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/import_export/base_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module ImportExport
class BaseExporter
attr_reader :export_data, :categories
attr_reader :export_data

CATEGORY_ATTRS = %i[
id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module Chat
class UserMessageBookmarkSerializer < UserBookmarkBaseSerializer
attr_reader :chat_message

def title
fancy_title
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ def component
page.find(context)
end

def flag(message)
find(message).secondary_action("flag")
end

def copy_link(message)
find(message).secondary_action("copyLink")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ def last_reply_datetime_selector(last_reply)
".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")
Expand Down
4 changes: 0 additions & 4 deletions plugins/chat/spec/system/page_objects/sidebar/sidebar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ def channels_section
find(PUBLIC_CHANNELS_SECTION_SELECTOR)
end

def channels_section
find(PUBLIC_CHANNELS_SECTION_SELECTOR)
end

def dms_section
find(DM_CHANNELS_SECTION_SELECTOR)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/support/fake_logger.rb
Original file line number Diff line number Diff line change
@@ -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 = []
Expand All @@ -14,7 +14,7 @@ def initialize
end

def debug(message)
@debug << message
@debugs << message
end

def debug?
Expand Down
6 changes: 0 additions & 6 deletions spec/system/page_objects/modals/sidebar_edit_categories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ def has_categories?(categories)
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",
Expand Down

0 comments on commit 138bf48

Please sign in to comment.