Fix inherit_mode for third-party gems #1192
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #1126
See palkan/action_policy#103 (comment)
If a third-party gem, e.g.
action_policy, defines theirconfig/default.ymland supplements to the default RSpec DSL that we provide in ourconfig/default.yml,rubocop's behaviour is to actually override the configuration, asinherit_modeisoverridefor lists by default.RuboCop has recently fixed the problem with ignored
inherit_modeand we've bumped to userubocopversion that includes the fix, but we haven't adjusted ourconfig/default.ymlto 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.
A little more context and reasoning for this fix palkan/action_policy#103 (comment)
Example
A new project
Ideally, both the duplicated
it_behaves_likeandsucceedshould be detected. However,action_policy'sIncludes/Examplessetting overrides ours, andit_behaves_likedisappears from this list. As a result,rubocoponly detects the duplication ofsucceed, but not ofit_behaves_like.References
RSpec DSL configuration ticket #333
RSpec DSL configuration PR #956
Problem with merging #1126
Fix for ignored
inherit_moderubocop/rubocop#9952#1181
https://docs.rubocop.org/rubocop/1.0/configuration.html#merging-arrays-using-inherit_mode
https://docs.rubocop.org/rubocop/1.9/configuration.html#unusual-files-that-would-not-be-included-by-default
Documentation for third-party gems to work with
rubocop-rspechttps://docs.rubocop.org/rubocop-rspec/third_party_rspec_syntax_extensions.html#1077
Example third-party gem RSpec DSL configuration palkan/action_policy#138
Before submitting the PR make sure the following are checked:
master(if not - rebase it).CHANGELOG.mdif the new code introduces user-observable changes.bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).