You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fixes#1126
See palkan/action_policy#103 (comment)
If a third-party gem, e.g. `action_policy`, defines their
`config/default.yml` and supplements to the default RSpec DSL that we
provide in our `config/default.yml`, `rubocop`'s behaviour is to
actually override the configuration, as `inherit_mode` is `override` for
lists by default.
RuboCop has recently [fixed the problem with ignored
`inherit_mode`](rubocop/rubocop#9952) and we've
[bumped to use `rubocop` version that includes the
fix](#1181), but we haven't
adjusted our `config/default.yml` to merge by default.
This is causing both user project RSpec DSL configuration and
third-party gem RSpec DSL configuration to override our default,
rendering our cops blind.
### Example
A new project
```ruby
# Gemfile
source 'https://rubygems.org'
gem 'action_policy'
gem 'rubocop-rspec'
```
```yml
# .rubocop.yml
require:
- rubocop-rspec
inherit_gem:
action_policy: config/rubocop-rspec.yml
```
```ruby
# spec/a_spec.rb
RSpec.describe 'A' do
it_behaves_like 'a'
it_behaves_like 'a'
describe_rule :show? do
succeed 'when post is published'
succeed 'when post is published'
end
end
```
Ideally, both the duplicated `it_behaves_like` and `succeed` should be
detected. However, `action_policy`'s `Includes/Examples` setting
overrides ours, and `it_behaves_like` disappears from this list. As a
result, `rubocop` only detects the duplication of `succeed`, but not of
`it_behaves_like`.
NOTE: Due to a [bug](https://github.com/rubocop/rubocop-rspec/issues/1126), this feature doesn't work properly for `rubocop-rspec` 2.5.0 and earlier versions.
12
+
11
13
For a third-party gem, it's sufficient to follow three steps:
12
14
13
15
1. Provide a configuration file (e.g. `.rubocop_rspec_alias_config.yml` or `config/rubocop-rspec.yml`).
0 commit comments