Skip to content

Commit 7613767

Browse files
committed
Add a guideline about nested departments
1 parent 4d9df0e commit 7613767

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

docs/modules/ROOT/pages/upgrade_to_version_2.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +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
1011

1112
[discrete]
1213
=== Adjust the configuration of `RSpec/EmptyExampleGroup`
@@ -29,6 +30,40 @@ AllCops:
2930
- include_tests
3031
----
3132

33+
=== Add a top-level `RSpec` department
34+
35+
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`.
37+
To avoid issues, e.g. inability to disable just one of the cops, each extension now has its own uber-department.
38+
Expectedly, RuboCop RSpec's uber-department name is `RSpec`.
39+
40+
[source,yaml]
41+
----
42+
# .rubocop.yml
43+
44+
# Before
45+
RSpec/EmptyExampleGroup:
46+
Enabled: false
47+
48+
Capybara/CurrentPathExpectation:
49+
Enabled: false
50+
51+
FactoryBot/AttributeDefinedStatically:
52+
Enabled: false
53+
54+
# After
55+
RSpec/RSpec/EmptyExampleGroup:
56+
Enabled: false
57+
58+
RSpec/Capybara/CurrentPathExpectation:
59+
Enabled: false
60+
61+
RSpec/FactoryBot/AttributeDefinedStatically:
62+
Enabled: false
63+
----
64+
65+
https://github.com/rubocop-hq/rubocop/pull/8490[Learn more about this change].
66+
3267
== Custom Cop Update Guide
3368

3469
Due to significant API changes custom cops will break.

0 commit comments

Comments
 (0)