Skip to content

Commit

Permalink
fixup! Update cop department namespacing upgrade docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj committed Aug 23, 2020
1 parent 7613767 commit edef2bb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions docs/modules/ROOT/pages/upgrade_to_version_2.adoc
Expand Up @@ -7,7 +7,7 @@ In version 2.x:

- `RSpec/InvalidPredicateMatcher` cop is removed
- `CustomIncludeMethods` configuration option for `RSpec/EmptyExampleGroup` is removed
- cop departments are nested
- cop departments are nested for cops with a department that doesn't match the extension name (`Capybara`, `FactoryBot`, `Rails`)

[discrete]
=== Adjust the configuration of `RSpec/EmptyExampleGroup`
Expand All @@ -33,33 +33,35 @@ AllCops:
=== Add a top-level `RSpec` department

RuboCop extensions had cops with clashing names and departments, e.g. both `rspec-rails` and `rubocop-rspec` had `Rails::HttpStatus` cops.
Also, in some circumstances RuboCop was complaining that some cops have wrong departments specified in the config file, e.g. `RSpec::FilePath` and `Rails::FilePath`, `RSpec/VariableName` and `Naming/VariableName`.
To avoid issues, e.g. inability to disable just one of the cops, each extension now has its own uber-department.
Expectedly, RuboCop RSpec's uber-department name is `RSpec`.
Changes are only applied to cops that don't already have the department set to `RSpec`, i.e. `Capybara`, `FactoryBot` and `Rails`.

[source,yaml]
----
# .rubocop.yml
# Before
RSpec/EmptyExampleGroup:
Enabled: false
Capybara/CurrentPathExpectation:
Enabled: false
FactoryBot/AttributeDefinedStatically:
Enabled: false
# After
RSpec/RSpec/EmptyExampleGroup:
# remains the same
RSpec/EmptyExampleGroup:
Enabled: false
# After
RSpec/Capybara/CurrentPathExpectation:
Enabled: false
RSpec/FactoryBot/AttributeDefinedStatically:
Enabled: false
# remains the same
RSpec/EmptyExampleGroup:
Enabled: false
----

https://github.com/rubocop-hq/rubocop/pull/8490[Learn more about this change].
Expand Down

0 comments on commit edef2bb

Please sign in to comment.