Don't disable RSpec/DuplicateSpecLocation inline
Problem
We've seen a master broken due to RSpec/DuplicateSpecLocation.
The reason was that this cop rule was inline disabled in the newly added EE spec (ee/spec/foo/bar_spec.rb) ignoring the fact that EE extension spec (ee/spec/foo/ee/bar_spec.rb) already existed. Since the RuboCop CI job only checked the EE spec (and not EE extension spec) it passed on the MR but failed on master.
Proposed solution
-
Instead of trying to fix a potential test-gap we should never disable this cop rule inline. -
ee/spec/services/branches/delete_service_spec.rb->ee/spec/services/ee/branches/delete_service_spec.rb -
ee/spec/graphql/types/clusters/agent_type_spec.rb->ee/spec/graphql/ee/types/clusters/agent_type_spec.rb- !165001 (merged)
-
-
(Optional) Teach Danger to disable disabling this cop inline
List of inline disables
The following files should be consolidated into one:
-
ee/spec/services/branches/delete_service_spec.rb->ee/spec/services/ee/branches/delete_service_spec.rb -
ee/spec/graphql/types/clusters/agent_type_spec.rb->ee/spec/graphql/ee/types/clusters/agent_type_spec.rb
because in both cases we don't have a EE code but only EE extension code.
Search
$ rg "disable.*DuplicateSpecLocation"
ee/spec/services/branches/delete_service_spec.rb
5:# rubocop: disable RSpec/DuplicateSpecLocation
ee/spec/services/ee/branches/delete_service_spec.rb
5:# rubocop: disable RSpec/DuplicateSpecLocation
ee/spec/graphql/types/clusters/agent_type_spec.rb
5:RSpec.describe GitlabSchema.types['ClusterAgent'], feature_category: :deployment_management do # rubocop:disable RSpec/DuplicateSpecLocation -- EE spec
ee/spec/graphql/ee/types/clusters/agent_type_spec.rb
5:RSpec.describe GitlabSchema.types['ClusterAgent'], feature_category: :environment_management do # rubocop:disable RSpec/DuplicateSpecLocation -- EE spec
Edited by Andy Schoenen