RuboCop does not suggest to add extensions that have already been configured in an inherited gem.
RuboCop suggests extensions that are already configured.
rspecinherit_gem in its .rubocop.yml, and inherit from a gem that depends on rubocop-rspec and has require: rubocop-rspec in its RuboCop configrubocop-rspecMinimal repro here: https://github.com/haines/rubocop-inherited-extensions-bug
$ git clone https://github.com/haines/rubocop-inherited-extensions-bug.git
$ cd rubocop-inherited-extensions-bug/project
$ bundle install
$ bundle exec rubocop
Inspecting 2 files
.C
Offenses:
spec/some_spec.rb:3:16: C: RSpec/DescribeClass: The first argument to describe should be the class or module being tested.
RSpec.describe 'offensive' do
^^^^^^^^^^^
2 files inspected, 1 offense detected
Tip: Based on detected gems, the following RuboCop extension libraries might be helpful:
* rubocop-rspec (http://github.com/rubocop-hq/rubocop-rspec)
You can opt out of this message by adding the following to your config (see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions for more options):
AllCops:
SuggestExtensions: false
From the offense that's detected, it's clear that rubocop-rspec is configured, so the "Tip" shouldn't be displayed.
$ bundle exec rubocop -V
1.5.1 (using Parser 2.7.2.0, rubocop-ast 1.3.0, running on ruby 2.7.2 x86_64-darwin19)
- rubocop-rspec 2.0.1
Sounds like a task for @dvandersluis.
Yeah it's not currently considering what's activated in rubocop.yml, just what's found from gems. I'll take a look!
@haines In the meantime this configuration should work for you:
AllCops:
SuggestExtensions:
rubocop-rspec: false
@haines can you confirm that rubocop-rspec is in your Gemfile.lock?
@dvandersluis thanks for looking into this!
rubocop-rspec is in the Gemfile.lock: https://github.com/haines/rubocop-inherited-extensions-bug/blob/ace95f260920531df2f9a84d1e9ba39868611955/project/Gemfile.lock#L43
It's not in the Gemfile, though; it's a transitive dependency.