Skip to content

Commit

Permalink
DEV: Update ruby linting
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX committed Oct 20, 2023
1 parent 7fe45c8 commit 0e297f0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 27 deletions.
28 changes: 16 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,47 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
base64 (0.1.1)
json (2.6.3)
language_server-protocol (3.17.0.3)
parallel (1.23.0)
parser (3.2.2.3)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
racc (1.7.1)
rainbow (3.1.1)
regexp_parser (2.8.1)
rexml (3.2.5)
rubocop (1.52.1)
regexp_parser (2.8.2)
rexml (3.2.6)
rubocop (1.57.1)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-discourse (3.2.0)
rubocop-discourse (3.4.0)
rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0)
rubocop-factory_bot (2.23.1)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-rspec (2.22.0)
rubocop-rspec (2.24.1)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
syntax_tree (6.1.1)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
unicode-display_width (2.4.2)
unicode-display_width (2.5.0)

PLATFORMS
ruby
Expand Down
4 changes: 2 additions & 2 deletions app/models/assignment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class Assignment < ActiveRecord::Base
belongs_to :target, polymorphic: true

scope :joins_with_topics,
-> {
-> do
joins(
"INNER JOIN topics ON topics.id = assignments.target_id AND assignments.target_type = 'Topic' AND topics.deleted_at IS NULL",
)
}
end

scope :active_for_group, ->(group) { where(assigned_to: group, active: true) }

Expand Down
2 changes: 1 addition & 1 deletion lib/assigner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def moderator_post_unassign_action_code(assignment)
""
end
return "unassigned#{suffix}" if assignment.assigned_to_user?
return "unassigned_group#{suffix}" if assignment.assigned_to_group?
"unassigned_group#{suffix}" if assignment.assigned_to_group?
end

def already_assigned?(assign_to, type, note, status)
Expand Down
4 changes: 2 additions & 2 deletions lib/discourse_assign/group_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module GroupExtension
def self.prepended(base)
base.class_eval do
scope :assignable,
->(user) {
->(user) do
where(
"assignable_level in (:levels) OR
(
Expand All @@ -18,7 +18,7 @@ def self.prepended(base)
levels: alias_levels(user),
user_id: user&.id,
)
}
end
end
end
end
Expand Down
20 changes: 10 additions & 10 deletions spec/lib/pending_assigns_reminder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_relative "../support/assign_allowed_group"

def assert_reminder_not_created
expect { subject.remind(user) }.not_to change { Post.count }
expect { described_class.remind(user) }.not_to change { Post.count }
end

RSpec.describe PendingAssignsReminder do
Expand Down Expand Up @@ -48,7 +48,7 @@ def assert_reminder_not_created

it "creates a reminder for a particular user and sets the timestamp of the last reminder" do
freeze_time
subject.remind(user)
described_class.remind(user)

post = Post.last

Expand All @@ -71,8 +71,8 @@ def assert_reminder_not_created
end

it "deletes previous reminders when creating a new one" do
subject.remind(user)
subject.remind(user)
described_class.remind(user)
described_class.remind(user)

reminders_count =
Topic
Expand All @@ -84,15 +84,15 @@ def assert_reminder_not_created
end

it "doesn't delete reminders from a different user" do
subject.remind(user)
described_class.remind(user)
another_user = Fabricate(:user)
add_to_assign_allowed_group(another_user)
3.times do
post = Fabricate(:post)
Assigner.new(post.topic, user).assign(another_user)
end

subject.remind(another_user)
described_class.remind(another_user)

reminders_count =
Topic
Expand All @@ -104,9 +104,9 @@ def assert_reminder_not_created
end

it "doesn't delete reminders if they have replies" do
subject.remind(user)
described_class.remind(user)
Fabricate(:post, topic: Topic.last)
subject.remind(user)
described_class.remind(user)

reminders_count =
Topic
Expand All @@ -123,7 +123,7 @@ def assert_reminder_not_created
@post5 = Fabricate(:post)
Assigner.new(@post5.topic, user).assign(user)

subject.remind(user)
described_class.remind(user)

post = Post.last
topic = post.topic
Expand All @@ -133,7 +133,7 @@ def assert_reminder_not_created
@post5.topic.update_status("closed", true, Discourse.system_user)
expect(@post5.topic.closed).to eq(true)

subject.remind(user)
described_class.remind(user)

post = Post.last
topic = post.topic
Expand Down

0 comments on commit 0e297f0

Please sign in to comment.