Skip to content

Commit 5ba3146

Browse files
hsbtclaude
andcommitted
Fix rubocop configuration not being loaded
Some rubocop versions prioritize ~/.config/rubocop/config.yml over the project's .rubocop.yml, causing all project settings to be ignored. Explicitly specify the config file in the Rake task to work around this, and update CI to use rake rubocop instead of invoking rubocop directly. Also bump rubocop and rubocop-performance minimum versions to support the plugins directive, and switch from require to plugins in .rubocop.yml. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 875d129 commit 5ba3146

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ jobs:
1717
ruby-version: 3.3
1818
bundler-cache: true # 'bundle install' and cache
1919
- name: Rubocop
20-
run: bundle exec rubocop
20+
run: bundle exec rake rubocop
2121

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
inherit_from: .rubocop-bundler.yml
2-
require:
2+
plugins:
33
- rubocop-performance
44
AllCops:
55
NewCops: disable

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ platform :ruby do
2424
end
2525

2626
group :linting do
27-
gem "rubocop", "~> 1.44"
28-
gem "rubocop-performance", "~> 1.5"
27+
gem "rubocop", "~> 1.72"
28+
gem "rubocop-performance", "~> 1.24"
2929
end
3030

3131
group :test do

Rakefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ require "bundler/gem_tasks"
44
require "rspec/core/rake_task"
55
require "rubocop/rake_task"
66

7-
RuboCop::RakeTask.new
7+
# Workaround: some rubocop versions prioritize ~/.config/rubocop/config.yml
8+
# over the project's .rubocop.yml, so we explicitly specify the config file.
9+
RuboCop::RakeTask.new do |t|
10+
t.options = %w[-c .rubocop.yml]
11+
end
812

913
desc "Run specs"
1014
RSpec::Core::RakeTask.new(:spec) do |t|

0 commit comments

Comments
 (0)