Skip to content

Commit 29a74d6

Browse files
justin808claude
andcommitted
Lock RuboCop gem versions and fix all linting issues
- Lock rubocop-performance to 1.23.1 - Lock rubocop-rails to 2.29.1 - Lock rubocop-rspec to 3.4.0 - Auto-fix all 23 correctable RuboCop offenses - Update code to follow current RuboCop standards 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6ff6c4f commit 29a74d6

File tree

10 files changed

+30
-32
lines changed

10 files changed

+30
-32
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,9 @@ DEPENDENCIES
512512
redis (~> 5.0)
513513
rspec-rails (~> 6.0.0)
514514
rubocop (= 1.69)
515-
rubocop-performance (~> 1.13)
516-
rubocop-rails
517-
rubocop-rspec (~> 3.3)
515+
rubocop-performance (= 1.23.1)
516+
rubocop-rails (= 2.29.1)
517+
rubocop-rspec (= 3.4.0)
518518
sass-rails
519519
scss_lint
520520
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

config/initializers/react_on_rails.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
#
2323
# This configuration tells React on Rails where to find bundles in test environment.
2424
# Without this, it defaults to public/webpack/test/ instead of public/packs/
25-
if Rails.env.test?
26-
config.generated_assets_dir = File.join(Rails.root, "public", "packs")
27-
end
25+
config.generated_assets_dir = Rails.public_path.join("packs").to_s if Rails.env.test?
2826

2927
################################################################################
3028
# CLIENT RENDERING OPTIONS

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)