Skip to content

Commit

Permalink
Workaround for rubocop-rspec_rails 2.28
Browse files Browse the repository at this point in the history
The fix for #12836 will be improved.
This issue is related to the development dependency rubocop-rspec_rails,
and modifying RuboCop's production code was not appropriate.
The version will be locked in the Gemfile until a correction can be made to rubocop-rspec_rails.
  • Loading branch information
koic authored and bbatsov committed Apr 12, 2024
1 parent b017d1c commit c6e0d4b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ gem 'rspec', '~> 3.7'
gem 'rubocop-performance', '~> 1.21.0'
gem 'rubocop-rake', '~> 0.6.0'
gem 'rubocop-rspec', '~> 2.29.1'
# This is a workaround to prevent the following error in rubocop-rspec_rails 2.28.3:
# https://github.com/rubocop/rubocop/actions/runs/8656558784/job/23737409762
# Please remove this dependency when the issue is resolved.
gem 'rubocop-rspec_rails', '2.28.2'
# Workaround for cc-test-reporter with SimpleCov 0.18.
# Stop upgrading SimpleCov until the following issue will be resolved.
# https://github.com/codeclimate/test-reporter/issues/418
Expand Down
4 changes: 0 additions & 4 deletions lib/rubocop/cop/badge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ def hash
end

def match?(other)
# Prevents the following error:
# https://github.com/rubocop/rubocop/actions/runs/8656558784/job/23737409762
return false if other.nil?

cop_name == other.cop_name && (!qualified? || department == other.department)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def with(cops)
end

def resolve_badge(given_badge, real_badge, source_path)
if real_badge && !given_badge.match?(real_badge)
unless given_badge.match?(real_badge)
path = PathUtil.smart_path(source_path)
warn "#{path}: #{given_badge} has the wrong namespace - " \
"replace it with #{given_badge.with_department(real_badge.department)}"
Expand Down
7 changes: 0 additions & 7 deletions spec/rubocop/comment_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ def disabled_lines_of_cop(cop)
end

it 'supports disabling cops with multiple levels in department name' do
# Workaround for the following build error:
# https://app.circleci.com/pipelines/github/rubocop/rubocop/11035/workflows/d1f7575e-614f-437b-9d83-494fc94c78b4/jobs/309630
#
# Fix to the rubocop-rspec_rails monkey patch is required.
# https://github.com/rubocop/rubocop-rspec_rails/pull/14
skip 'Fix to the rubocop-rspec-rails monkey patch is required.'

disabled_lines = disabled_lines_of_cop('RSpec/Rails/HttpStatus')
expected_part = (51..53).to_a
expect(disabled_lines & expected_part).to eq(expected_part)
Expand Down

0 comments on commit c6e0d4b

Please sign in to comment.