Skip to content

Commit 1b582a6

Browse files
justin808claude
andcommitted
Lock RuboCop extension gem versions to prevent CI failures (#653)
* Lock RuboCop extension gem versions to prevent CI failures - Lock rubocop-performance to 1.23.1 (was ~> 1.13) - Lock rubocop-rails to 2.29.1 (was no version constraint) - Lock rubocop-rspec to 3.4.0 (was ~> 3.3) This prevents future CI failures due to new RuboCop versions introducing stricter rules. When we want to upgrade RuboCop rules, we can do so intentionally in a separate PR with proper code fixes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix all RuboCop violations with locked versions Auto-fix 24 RuboCop offenses detected by the locked versions: - Update redundant .all method calls - Modernize strong parameters syntax - Improve Rails path methods - Update where clause usage - Use Rails.env.local? method This ensures the locked RuboCop versions pass CI while maintaining current code quality standards. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d292338 commit 1b582a6

File tree

9 files changed

+49
-46
lines changed

9 files changed

+49
-46
lines changed

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ group :development, :test do
7575
################################################################################
7676
# Linters and Security
7777
gem "rubocop", "1.69", require: false
78-
gem "rubocop-performance", "~> 1.13"
79-
gem "rubocop-rails"
80-
gem "rubocop-rspec", "~> 3.3"
78+
gem "rubocop-performance", "1.23.1", require: false
79+
gem "rubocop-rails", "2.29.1", require: false
80+
gem "rubocop-rspec", "3.4.0", require: false
8181
# Critical that require: false be set! https://github.com/brigade/scss-lint/issues/278
8282
gem "scss_lint", require: false
8383

Gemfile.lock

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ GEM
8181
uri (>= 0.13.1)
8282
addressable (2.8.7)
8383
public_suffix (>= 2.0.2, < 7.0)
84-
ast (2.4.2)
84+
ast (2.4.3)
8585
autoprefixer-rails (10.4.16.0)
8686
execjs (~> 2)
8787
awesome_print (1.9.2)
@@ -167,8 +167,8 @@ GEM
167167
jbuilder (2.12.0)
168168
actionview (>= 5.0.0)
169169
activesupport (>= 5.0.0)
170-
json (2.7.2)
171-
language_server-protocol (3.17.0.3)
170+
json (2.14.1)
171+
language_server-protocol (3.17.0.5)
172172
launchy (3.0.1)
173173
addressable (~> 2.8)
174174
childprocess (~> 5.0)
@@ -208,14 +208,15 @@ GEM
208208
nokogiri (1.18.10-x86_64-linux-gnu)
209209
racc (~> 1.4)
210210
package_json (0.1.0)
211-
parallel (1.26.3)
212-
parser (3.3.3.0)
211+
parallel (1.27.0)
212+
parser (3.3.9.0)
213213
ast (~> 2.4.1)
214214
racc
215215
pg (1.5.6)
216216
pp (0.6.2)
217217
prettyprint
218218
prettyprint (0.2.0)
219+
prism (1.5.1)
219220
protocol (2.0.0)
220221
ruby_parser (~> 3.0)
221222
pry (0.14.2)
@@ -309,7 +310,7 @@ GEM
309310
redis-client (>= 0.22.0)
310311
redis-client (0.22.2)
311312
connection_pool
312-
regexp_parser (2.9.2)
313+
regexp_parser (2.11.3)
313314
reline (0.6.2)
314315
io-console (~> 0.5)
315316
require_all (3.0.0)
@@ -342,16 +343,18 @@ GEM
342343
rubocop-ast (>= 1.36.1, < 2.0)
343344
ruby-progressbar (~> 1.7)
344345
unicode-display_width (>= 2.4.0, < 4.0)
345-
rubocop-ast (1.36.1)
346-
parser (>= 3.3.1.0)
347-
rubocop-performance (1.19.1)
348-
rubocop (>= 1.7.0, < 2.0)
349-
rubocop-ast (>= 0.4.0)
350-
rubocop-rails (2.15.2)
346+
rubocop-ast (1.47.0)
347+
parser (>= 3.3.7.2)
348+
prism (~> 1.4)
349+
rubocop-performance (1.23.1)
350+
rubocop (>= 1.48.1, < 2.0)
351+
rubocop-ast (>= 1.31.1, < 2.0)
352+
rubocop-rails (2.29.1)
351353
activesupport (>= 4.2.0)
352354
rack (>= 1.1)
353-
rubocop (>= 1.7.0, < 2.0)
354-
rubocop-rspec (3.3.0)
355+
rubocop (>= 1.52.0, < 2.0)
356+
rubocop-ast (>= 1.31.1, < 2.0)
357+
rubocop-rspec (3.4.0)
355358
rubocop (~> 1.61)
356359
ruby-progressbar (1.13.0)
357360
ruby_parser (3.21.0)
@@ -429,9 +432,9 @@ GEM
429432
concurrent-ruby (~> 1.0)
430433
uglifier (4.2.0)
431434
execjs (>= 0.3.0, < 3)
432-
unicode-display_width (3.1.2)
433-
unicode-emoji (~> 4.0, >= 4.0.4)
434-
unicode-emoji (4.0.4)
435+
unicode-display_width (3.2.0)
436+
unicode-emoji (~> 4.1)
437+
unicode-emoji (4.1.0)
435438
uri (1.0.3)
436439
useragent (0.16.11)
437440
web-console (4.2.1)
@@ -487,9 +490,9 @@ DEPENDENCIES
487490
redis (~> 5.0)
488491
rspec-rails (~> 6.0.0)
489492
rubocop (= 1.69)
490-
rubocop-performance (~> 1.13)
491-
rubocop-rails
492-
rubocop-rspec (~> 3.3)
493+
rubocop-performance (= 1.23.1)
494+
rubocop-rails (= 2.29.1)
495+
rubocop-rspec (= 3.4.0)
493496
sass-rails
494497
scss_lint
495498
sdoc

app/controllers/comments_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def inline_form
102102
private
103103

104104
def set_comments
105-
@comments = Comment.all.order("id DESC")
105+
@comments = Comment.order("id DESC")
106106
end
107107

108108
# Use callbacks to share common setup or constraints between actions.
@@ -116,6 +116,6 @@ def new_comment
116116

117117
# Never trust parameters from the scary internet, only allow the white list through.
118118
def comment_params
119-
params.require(:comment).permit(:author, :text)
119+
params.expect(comment: %i[author text])
120120
end
121121
end

app/controllers/pages_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def rescript; end
4141
private
4242

4343
def set_comments
44-
@comments = Comment.all.order("id DESC")
44+
@comments = Comment.order("id DESC")
4545
end
4646

4747
def comments_json_string

lib/tasks/ci.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
if Rails.env.development? || Rails.env.test?
3+
if Rails.env.local?
44
# See tasks/linters.rake
55

66
task js_tests: :environment do

lib/tasks/daily.rake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
task daily: :environment do
44
t = 1.day.ago
5-
older_comments = Comment.where("created_at < ?", t)
6-
newer_comments = Comment.where("created_at >= ?", t)
5+
older_comments = Comment.where(created_at: ...t)
6+
newer_comments = Comment.where(created_at: t..)
77
puts "Deleting #{older_comments.count} comments older than #{t}"
88
puts "Keeping #{newer_comments.count} comments newer than #{t}"
99
older_comments.delete_all

spec/rails_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
# Requires supporting files with custom matchers and macros, etc,
3737
# in ./support/ and its subdirectories.
38-
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f }
38+
Rails.root.glob("spec/support/**/*.rb").sort.each { |f| require f }
3939

4040
RSpec.configure do |config|
4141
config.include FactoryBot::Syntax::Methods

spec/rescript/rescript_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,41 @@
4646
end
4747

4848
it "comment count increases with successful form submission" do
49-
initital_comment_count = Comment.all.count
49+
initital_comment_count = Comment.count
5050
new_comment_count = initital_comment_count + 1
5151
fill_in author_field, with: comment.author
5252
fill_in text_field, with: comment.text
5353
click_button("Post")
5454

5555
page.driver.browser.manage.timeouts.implicit_wait = 1
5656

57-
expect(Comment.all.count).to equal(new_comment_count)
57+
expect(Comment.count).to equal(new_comment_count)
5858
end
5959

6060
it "comment count remains the same when author field is empty" do
61-
initial_comment_count = Comment.all.count
61+
initial_comment_count = Comment.count
6262
fill_in text_field, with: comment.text
6363
click_button("Post")
6464

6565
expect(page).to have_text(/Can't save the comment!/)
66-
expect(Comment.all.count).to equal(initial_comment_count)
66+
expect(Comment.count).to equal(initial_comment_count)
6767
end
6868

6969
it "comment count remains the same when text field is empty" do
70-
initial_comment_count = Comment.all.count
70+
initial_comment_count = Comment.count
7171
fill_in author_field, with: comment.author
7272
click_button("Post")
7373

7474
expect(page).to have_text(/Can't save the comment!/)
75-
expect(Comment.all.count).to equal(initial_comment_count)
75+
expect(Comment.count).to equal(initial_comment_count)
7676
end
7777

7878
it "comment count remains the same when both form fields are empty" do
79-
initial_comment_count = Comment.all.count
79+
initial_comment_count = Comment.count
8080
click_button("Post")
8181

8282
expect(page).to have_text(/Can't save the comment!/)
83-
expect(Comment.all.count).to equal(initial_comment_count)
83+
expect(Comment.count).to equal(initial_comment_count)
8484
end
8585
end
8686
end

spec/stimulus/turbo_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,41 +41,41 @@
4141
end
4242

4343
it "adds a new comment to the page and database" do
44-
initital_comment_count = Comment.all.count
44+
initital_comment_count = Comment.count
4545
new_comment_count = initital_comment_count + 1
4646
fill_in author_field, with: comment.author
4747
fill_in text_field, with: comment.text
4848
click_button("Post")
4949

5050
expect(page).to have_css("h2", text: comment.author)
5151
expect(page).to have_css("p", text: comment.text)
52-
expect(Comment.all.count).to equal(new_comment_count)
52+
expect(Comment.count).to equal(new_comment_count)
5353
end
5454

5555
it "comment count remains the same when author field is empty" do
56-
initial_comment_count = Comment.all.count
56+
initial_comment_count = Comment.count
5757
fill_in text_field, with: comment.text
5858
click_button("Post")
5959

6060
expect(page).to have_text("Author: can't be blank")
61-
expect(Comment.all.count).to equal(initial_comment_count)
61+
expect(Comment.count).to equal(initial_comment_count)
6262
end
6363

6464
it "comment count remains the same when text field is empty" do
65-
initial_comment_count = Comment.all.count
65+
initial_comment_count = Comment.count
6666
fill_in author_field, with: comment.author
6767
click_button("Post")
6868

6969
expect(page).to have_text("Text: can't be blank")
70-
expect(Comment.all.count).to equal(initial_comment_count)
70+
expect(Comment.count).to equal(initial_comment_count)
7171
end
7272

7373
it "comment count remains the same when both form fields are empty" do
74-
initial_comment_count = Comment.all.count
74+
initial_comment_count = Comment.count
7575
click_button("Post")
7676

7777
expect(page).to have_text("Author: can't be blank")
78-
expect(Comment.all.count).to equal(initial_comment_count)
78+
expect(Comment.count).to equal(initial_comment_count)
7979
end
8080
end
8181
end

0 commit comments

Comments
 (0)