Skip to content

Commit 6ed4a13

Browse files
authored
DEV: Update ruby linting (#518)
1 parent 7fe45c8 commit 6ed4a13

File tree

5 files changed

+33
-27
lines changed

5 files changed

+33
-27
lines changed

Gemfile.lock

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,47 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
ast (2.4.2)
5+
base64 (0.1.1)
56
json (2.6.3)
7+
language_server-protocol (3.17.0.3)
68
parallel (1.23.0)
7-
parser (3.2.2.3)
9+
parser (3.2.2.4)
810
ast (~> 2.4.1)
911
racc
1012
prettier_print (1.2.1)
1113
racc (1.7.1)
1214
rainbow (3.1.1)
13-
regexp_parser (2.8.1)
14-
rexml (3.2.5)
15-
rubocop (1.52.1)
15+
regexp_parser (2.8.2)
16+
rexml (3.2.6)
17+
rubocop (1.57.1)
18+
base64 (~> 0.1.1)
1619
json (~> 2.3)
20+
language_server-protocol (>= 3.17.0)
1721
parallel (~> 1.10)
18-
parser (>= 3.2.2.3)
22+
parser (>= 3.2.2.4)
1923
rainbow (>= 2.2.2, < 4.0)
2024
regexp_parser (>= 1.8, < 3.0)
2125
rexml (>= 3.2.5, < 4.0)
22-
rubocop-ast (>= 1.28.0, < 2.0)
26+
rubocop-ast (>= 1.28.1, < 2.0)
2327
ruby-progressbar (~> 1.7)
2428
unicode-display_width (>= 2.4.0, < 3.0)
2529
rubocop-ast (1.29.0)
2630
parser (>= 3.2.1.0)
27-
rubocop-capybara (2.18.0)
31+
rubocop-capybara (2.19.0)
2832
rubocop (~> 1.41)
29-
rubocop-discourse (3.2.0)
33+
rubocop-discourse (3.4.0)
3034
rubocop (>= 1.1.0)
3135
rubocop-rspec (>= 2.0.0)
32-
rubocop-factory_bot (2.23.1)
36+
rubocop-factory_bot (2.24.0)
3337
rubocop (~> 1.33)
34-
rubocop-rspec (2.22.0)
38+
rubocop-rspec (2.24.1)
3539
rubocop (~> 1.33)
3640
rubocop-capybara (~> 2.17)
3741
rubocop-factory_bot (~> 2.22)
3842
ruby-progressbar (1.13.0)
39-
syntax_tree (6.1.1)
43+
syntax_tree (6.2.0)
4044
prettier_print (>= 1.2.0)
41-
unicode-display_width (2.4.2)
45+
unicode-display_width (2.5.0)
4246

4347
PLATFORMS
4448
ruby

app/models/assignment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ class Assignment < ActiveRecord::Base
99
belongs_to :target, polymorphic: true
1010

1111
scope :joins_with_topics,
12-
-> {
12+
-> do
1313
joins(
1414
"INNER JOIN topics ON topics.id = assignments.target_id AND assignments.target_type = 'Topic' AND topics.deleted_at IS NULL",
1515
)
16-
}
16+
end
1717

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

lib/assigner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def moderator_post_unassign_action_code(assignment)
530530
""
531531
end
532532
return "unassigned#{suffix}" if assignment.assigned_to_user?
533-
return "unassigned_group#{suffix}" if assignment.assigned_to_group?
533+
"unassigned_group#{suffix}" if assignment.assigned_to_group?
534534
end
535535

536536
def already_assigned?(assign_to, type, note, status)

lib/discourse_assign/group_extension.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module GroupExtension
55
def self.prepended(base)
66
base.class_eval do
77
scope :assignable,
8-
->(user) {
8+
->(user) do
99
where(
1010
"assignable_level in (:levels) OR
1111
(
@@ -18,7 +18,7 @@ def self.prepended(base)
1818
levels: alias_levels(user),
1919
user_id: user&.id,
2020
)
21-
}
21+
end
2222
end
2323
end
2424
end

spec/lib/pending_assigns_reminder_spec.rb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
require_relative "../support/assign_allowed_group"
55

66
def assert_reminder_not_created
7-
expect { subject.remind(user) }.not_to change { Post.count }
7+
expect { reminder.remind(user) }.not_to change { Post.count }
88
end
99

1010
RSpec.describe PendingAssignsReminder do
11+
subject(:reminder) { described_class.new }
12+
1113
before { SiteSetting.assign_enabled = true }
1214

1315
let(:user) { Fabricate(:user) }
@@ -48,7 +50,7 @@ def assert_reminder_not_created
4850

4951
it "creates a reminder for a particular user and sets the timestamp of the last reminder" do
5052
freeze_time
51-
subject.remind(user)
53+
reminder.remind(user)
5254

5355
post = Post.last
5456

@@ -71,8 +73,8 @@ def assert_reminder_not_created
7173
end
7274

7375
it "deletes previous reminders when creating a new one" do
74-
subject.remind(user)
75-
subject.remind(user)
76+
reminder.remind(user)
77+
reminder.remind(user)
7678

7779
reminders_count =
7880
Topic
@@ -84,15 +86,15 @@ def assert_reminder_not_created
8486
end
8587

8688
it "doesn't delete reminders from a different user" do
87-
subject.remind(user)
89+
reminder.remind(user)
8890
another_user = Fabricate(:user)
8991
add_to_assign_allowed_group(another_user)
9092
3.times do
9193
post = Fabricate(:post)
9294
Assigner.new(post.topic, user).assign(another_user)
9395
end
9496

95-
subject.remind(another_user)
97+
reminder.remind(another_user)
9698

9799
reminders_count =
98100
Topic
@@ -104,9 +106,9 @@ def assert_reminder_not_created
104106
end
105107

106108
it "doesn't delete reminders if they have replies" do
107-
subject.remind(user)
109+
reminder.remind(user)
108110
Fabricate(:post, topic: Topic.last)
109-
subject.remind(user)
111+
reminder.remind(user)
110112

111113
reminders_count =
112114
Topic
@@ -123,7 +125,7 @@ def assert_reminder_not_created
123125
@post5 = Fabricate(:post)
124126
Assigner.new(@post5.topic, user).assign(user)
125127

126-
subject.remind(user)
128+
reminder.remind(user)
127129

128130
post = Post.last
129131
topic = post.topic
@@ -133,7 +135,7 @@ def assert_reminder_not_created
133135
@post5.topic.update_status("closed", true, Discourse.system_user)
134136
expect(@post5.topic.closed).to eq(true)
135137

136-
subject.remind(user)
138+
reminder.remind(user)
137139

138140
post = Post.last
139141
topic = post.topic

0 commit comments

Comments
 (0)