Skip to content

Commit bfdbaf9

Browse files
committed
Implicit dependency on RuboCop RSpec
It is extracted from RuboCop RSpec, but needs to rely on rubocop-rspec_rails from RuboCop RSpec, and RuboCop RSpec Rails also needs to rely on rubocop-rspec. This makes them interdependent, and if you explicitly specify a dependency, you are stuck in an infinite loop. ``` ❯ bundle install Your bundle requires gems that depend on each other, creating an infinite loop. Please remove either gem 'rubocop-rspec' or gem 'rubocop-rspec_rails' and try again. ``` Therefore, this PR changes the dependency to be implicit. The next major version update of RuboCop RSpec will remove the dependency on rubocop-rspec_rails, so we will change the dependency to be explicit at that point.
1 parent 9a4c2a7 commit bfdbaf9

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

Diff for: .github/workflows/main.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ jobs:
8888
- uses: actions/checkout@v4
8989
- name: Use latest RuboCop RSpec from `master`
9090
run: |
91+
sed -e '/rubocop-rspec/d' -i Gemfile
9192
echo "gem 'rubocop-rspec', github: 'rubocop/rubocop-rspec'" > Gemfile.local
9293
- uses: ruby/setup-ruby@v1
9394
with:
@@ -102,7 +103,7 @@ jobs:
102103
- uses: actions/checkout@v4
103104
- name: Use latest RSpec 4 from `4-0-dev` branch
104105
run: |
105-
sed -e '/rspec/d' -i Gemfile
106+
sed -e '/^gem 'rspec/d' -i Gemfile
106107
cat << EOF > Gemfile.local
107108
gem 'rspec', github: 'rspec/rspec-metagem', branch: '4-0-dev'
108109
gem 'rspec-core', github: 'rspec/rspec-core', branch: '4-0-dev'

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Master (Unreleased)
44

5+
- Implicit dependency on RuboCop RSpec. Note that if you use rubocop-rspec_rails, you must also explicitly add rubocop-rspec to the Gemfile, because you are changing to an implicit dependency on RuboCop RSpec. ([@ydah])
6+
57
## 2.28.0 (2024-03-28)
68

79
- Extracted from `rubocop-rspec` into a separate repository. ([@ydah])

Diff for: Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@ gem 'rubocop-rake', '~> 0.6'
1414
gem 'simplecov', '>= 0.19'
1515
gem 'yard'
1616

17+
# TODO: Move to gemspec when RuboCop RSpec v3 is released.
18+
gem 'rubocop-rspec', '~> 2.27'
19+
1720
local_gemfile = 'Gemfile.local'
1821
eval_gemfile(local_gemfile) if File.exist?(local_gemfile)

Diff for: README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99

1010
## Installation
1111

12-
Just install the `rubocop-rspec_rails` gem
12+
**This gem implicitly depends on the `rubocop-rspec` gem, so you should install it first.**
13+
Just install the `rubocop-rspec` and `rubocop-rspec_rails` gem
1314

1415
```bash
15-
gem install rubocop-rspec_rails
16+
gem install rubocop-rspec rubocop-rspec_rails
1617
```
1718

1819
or if you use bundler put this in your `Gemfile`
1920

2021
```ruby
22+
gem 'rubocop-rspec', require: false
2123
gem 'rubocop-rspec_rails', require: false
2224
```
2325

Diff for: docs/modules/ROOT/pages/installation.adoc

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
= Installation
22

3-
Just install the `rubocop-rspec_rails` gem
3+
*This gem implicitly depends on the `rubocop-rspec` gem, so you should install it first.*
4+
Just install the `rubocop-rspec` and `rubocop-rspec_rails` gem
45

56
[source,bash]
67
----
7-
gem install rubocop-rspec_rails
8+
gem install rubocop-rspec rubocop-rspec_rails
89
----
910

1011
or if you use bundler put this in your `Gemfile`
1112

1213
[source,ruby]
1314
----
14-
gem 'rubocop-rspec_rails'
15+
gem 'rubocop-rspec', require: false
16+
gem 'rubocop-rspec_rails', require: false
1517
----

Diff for: rubocop-rspec_rails.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ Gem::Specification.new do |spec|
3535
}
3636

3737
spec.add_runtime_dependency 'rubocop', '~> 1.40'
38-
spec.add_runtime_dependency 'rubocop-rspec', '~> 2.27'
3938
end

0 commit comments

Comments
 (0)