Skip to content

Commit edef2bb

Browse files
committed
fixup! Update cop department namespacing upgrade docs
1 parent 7613767 commit edef2bb

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

docs/modules/ROOT/pages/upgrade_to_version_2.adoc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ In version 2.x:
77

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

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

3535
RuboCop extensions had cops with clashing names and departments, e.g. both `rspec-rails` and `rubocop-rspec` had `Rails::HttpStatus` cops.
36-
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`.
3736
To avoid issues, e.g. inability to disable just one of the cops, each extension now has its own uber-department.
3837
Expectedly, RuboCop RSpec's uber-department name is `RSpec`.
38+
Changes are only applied to cops that don't already have the department set to `RSpec`, i.e. `Capybara`, `FactoryBot` and `Rails`.
3939

4040
[source,yaml]
4141
----
4242
# .rubocop.yml
4343
4444
# Before
45-
RSpec/EmptyExampleGroup:
46-
Enabled: false
47-
4845
Capybara/CurrentPathExpectation:
4946
Enabled: false
5047
5148
FactoryBot/AttributeDefinedStatically:
5249
Enabled: false
5350
54-
# After
55-
RSpec/RSpec/EmptyExampleGroup:
51+
# remains the same
52+
RSpec/EmptyExampleGroup:
5653
Enabled: false
5754
55+
# After
5856
RSpec/Capybara/CurrentPathExpectation:
5957
Enabled: false
6058
6159
RSpec/FactoryBot/AttributeDefinedStatically:
6260
Enabled: false
61+
62+
# remains the same
63+
RSpec/EmptyExampleGroup:
64+
Enabled: false
6365
----
6466

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

0 commit comments

Comments
 (0)