rubocop-rspec 2.29.1 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +92 -3
- data/README.md +21 -5
- data/config/default.yml +64 -269
- data/config/obsoletion.yml +20 -21
- data/lib/rubocop/cop/rspec/around_block.rb +2 -4
- data/lib/rubocop/cop/rspec/base.rb +0 -1
- data/lib/rubocop/cop/rspec/be_eq.rb +1 -1
- data/lib/rubocop/cop/rspec/be_eql.rb +1 -1
- data/lib/rubocop/cop/rspec/be_nil.rb +4 -0
- data/lib/rubocop/cop/rspec/change_by_zero.rb +4 -5
- data/lib/rubocop/cop/rspec/contain_exactly.rb +1 -0
- data/lib/rubocop/cop/rspec/context_wording.rb +15 -9
- data/lib/rubocop/cop/rspec/dialect.rb +13 -0
- data/lib/rubocop/cop/rspec/empty_example_group.rb +2 -0
- data/lib/rubocop/cop/rspec/empty_metadata.rb +1 -0
- data/lib/rubocop/cop/rspec/example_wording.rb +3 -5
- data/lib/rubocop/cop/rspec/excessive_docstring_spacing.rb +1 -1
- data/lib/rubocop/cop/rspec/expect_actual.rb +3 -3
- data/lib/rubocop/cop/rspec/expect_in_hook.rb +1 -1
- data/lib/rubocop/cop/rspec/expect_in_let.rb +42 -0
- data/lib/rubocop/cop/rspec/focus.rb +14 -16
- data/lib/rubocop/cop/rspec/implicit_expect.rb +3 -3
- data/lib/rubocop/cop/rspec/implicit_subject.rb +8 -0
- data/lib/rubocop/cop/rspec/indexed_let.rb +6 -3
- data/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +1 -1
- data/lib/rubocop/cop/rspec/match_array.rb +1 -0
- data/lib/rubocop/cop/rspec/message_spies.rb +4 -0
- data/lib/rubocop/cop/rspec/metadata_style.rb +1 -6
- data/lib/rubocop/cop/rspec/missing_expectation_target_method.rb +54 -0
- data/lib/rubocop/cop/rspec/mixin/metadata.rb +5 -8
- data/lib/rubocop/cop/rspec/mixin/top_level_group.rb +7 -0
- data/lib/rubocop/cop/rspec/multiple_describes.rb +1 -1
- data/lib/rubocop/cop/rspec/multiple_expectations.rb +4 -4
- data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +4 -5
- data/lib/rubocop/cop/rspec/named_subject.rb +5 -2
- data/lib/rubocop/cop/rspec/nested_groups.rb +2 -1
- data/lib/rubocop/cop/rspec/pending_without_reason.rb +0 -5
- data/lib/rubocop/cop/rspec/predicate_matcher.rb +25 -11
- data/lib/rubocop/cop/rspec/remove_const.rb +0 -1
- data/lib/rubocop/cop/rspec/repeated_subject_call.rb +1 -0
- data/lib/rubocop/cop/rspec/return_from_stub.rb +5 -4
- data/lib/rubocop/cop/rspec/scattered_setup.rb +7 -1
- data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +3 -4
- data/lib/rubocop/cop/rspec/sort_metadata.rb +22 -8
- data/lib/rubocop/cop/rspec/stubbed_mock.rb +15 -10
- data/lib/rubocop/cop/rspec/subject_stub.rb +2 -2
- data/lib/rubocop/cop/rspec/unspecified_exception.rb +21 -14
- data/lib/rubocop/cop/rspec/verified_double_reference.rb +14 -53
- data/lib/rubocop/cop/rspec/void_expect.rb +6 -1
- data/lib/rubocop/cop/rspec_cops.rb +2 -25
- data/lib/rubocop/rspec/concept.rb +0 -1
- data/lib/rubocop/rspec/config_formatter.rb +4 -32
- data/lib/rubocop/rspec/cop/generator.rb +25 -0
- data/lib/rubocop/rspec/description_extractor.rb +2 -2
- data/lib/rubocop/rspec/hook.rb +1 -1
- data/lib/rubocop/rspec/language.rb +0 -1
- data/lib/rubocop/rspec/node.rb +1 -1
- data/lib/rubocop/rspec/plugin.rb +37 -0
- data/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb +1 -1
- data/lib/rubocop/rspec/version.rb +1 -1
- data/lib/rubocop/rspec/wording.rb +2 -4
- data/lib/rubocop/rspec.rb +0 -7
- data/lib/rubocop-rspec.rb +2 -20
- metadata +18 -62
- data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +0 -39
- data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +0 -104
- data/lib/rubocop/cop/rspec/capybara/match_style.rb +0 -38
- data/lib/rubocop/cop/rspec/capybara/negation_matcher.rb +0 -33
- data/lib/rubocop/cop/rspec/capybara/specific_actions.rb +0 -29
- data/lib/rubocop/cop/rspec/capybara/specific_finders.rb +0 -24
- data/lib/rubocop/cop/rspec/capybara/specific_matcher.rb +0 -35
- data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +0 -36
- data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +0 -35
- data/lib/rubocop/cop/rspec/factory_bot/consistent_parentheses_style.rb +0 -50
- data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +0 -40
- data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +0 -29
- data/lib/rubocop/cop/rspec/factory_bot/factory_name_style.rb +0 -33
- data/lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb +0 -55
- data/lib/rubocop/cop/rspec/file_path.rb +0 -179
- data/lib/rubocop/cop/rspec/rails/avoid_setup_hook.rb +0 -27
- data/lib/rubocop/cop/rspec/rails/have_http_status.rb +0 -35
- data/lib/rubocop/cop/rspec/rails/http_status.rb +0 -61
- data/lib/rubocop/cop/rspec/rails/inferred_spec_type.rb +0 -62
- data/lib/rubocop/cop/rspec/rails/minitest_assertions.rb +0 -39
- data/lib/rubocop/cop/rspec/rails/negation_be_valid.rb +0 -39
- data/lib/rubocop/cop/rspec/rails/travel_around.rb +0 -34
- data/lib/rubocop/rspec/inject.rb +0 -18
- data/lib/rubocop/rspec/language/node_pattern.rb +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5852eb2103d4a2993b2174b7e4c97f5f7f09041c49407122ab6568d744d52c09
|
4
|
+
data.tar.gz: 710d277b8be358c99cadf4ca500141d23fa73347ba3f29db0585a1e7026abd73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e27d20e6945c05f12af9fc24e17e42691186b332611d96eb9e7a5444476de44209517ccdb4829096cff659e7a7d1b98941ff632b3f7f5a547aa4dc82d3e18e38
|
7
|
+
data.tar.gz: 93a9cb481828abc2e313129cec383d38de5261f382d7ae6fcabe42bd0146b5a134b90991df47cc0bade3c1e4266cbfcf733f35ea7bee8eafaa3e5e4236a0b3ca
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,85 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
+
## 3.5.0 (2025-02-16)
|
6
|
+
|
7
|
+
- Don't let `RSpec/PredicateMatcher` replace `respond_to?` with two arguments with the RSpec `respond_to` matcher. ([@bquorning])
|
8
|
+
- Fix `RSpec/PredicateMatcher` support for `eql` and `equal` matchers. ([@bquorning])
|
9
|
+
- Pluginfy RuboCop RSpec. ([@koic])
|
10
|
+
|
11
|
+
## 3.4.0 (2025-01-20)
|
12
|
+
|
13
|
+
- Fix `RSpec/SortMetadata` cop to limit sorting to trailing metadata arguments. ([@cbliard])
|
14
|
+
- Replace `RSpec/StringAsInstanceDoubleConstant` with `RSpec/VerifiedDoubleReference` configured to only support constant class references. ([@corsonknowles])
|
15
|
+
- Fix `RSpec/EmptyExampleGroup` cop false positive when a simple conditional is used inside an iterator. ([@lovro-bikic])
|
16
|
+
|
17
|
+
## 3.3.0 (2024-12-12)
|
18
|
+
|
19
|
+
- Deprecate `top_level_group?` method from `TopLevelGroup` mixin as all of its callers were intentionally removed from `Rubocop/RSpec`. ([@corsonknowles])
|
20
|
+
- Fix false positive for RSpec/EmptyMetadata for splat kwargs. ([@pirj])
|
21
|
+
|
22
|
+
## 3.2.0 (2024-10-26)
|
23
|
+
|
24
|
+
- Fix `RSpec/VoidExpect` to only operate inside an example block. ([@corsonknowles])
|
25
|
+
- Change `RSpec/ContextWording` cop to always report an offense when both `Prefixes` and `AllowedPatterns` are empty. ([@ydah])
|
26
|
+
- Add support for `and` and `or` compound matchers to `RSpec/ChangeByZero` cop. ([@ydah])
|
27
|
+
|
28
|
+
## 3.1.0 (2024-10-01)
|
29
|
+
|
30
|
+
- Add `RSpec/StringAsInstanceDoubleConstant` to check for and correct strings used as instance_doubles. ([@corsonknowles])
|
31
|
+
- Fix false-positive for `RSpec/UnspecifiedException` when a method is literally named `raise_exception`. ([@aarestad])
|
32
|
+
- Fix false-positive for `RSpec/UnspecifiedException` when `not_to raise_error` is used within a block. ([@aarestad], [@G-Rath])
|
33
|
+
|
34
|
+
## 3.0.5 (2024-09-07)
|
35
|
+
|
36
|
+
- Fix false-negative and error for `RSpec/MetadataStyle` when non-literal args are used in metadata in `EnforceStyle: hash`. ([@cbliard])
|
37
|
+
- Improve offense message for `RSpec/IndexedLet`. ([@earlopain])
|
38
|
+
|
39
|
+
## 3.0.4 (2024-08-05)
|
40
|
+
|
41
|
+
- Fix false-negative for `UnspecifiedException` when matcher is chained. ([@r7kamura])
|
42
|
+
|
43
|
+
## 3.0.3 (2024-07-12)
|
44
|
+
|
45
|
+
- Add support for Unicode RIGHT SINGLE QUOTATION MARK in `RSpec/ExampleWording`. ([@jdufresne])
|
46
|
+
- Suppress deprecation warning for `RSpec/MultipleExpectations`, `RSpec/MultipleMemoizedHelpers`, and `RSpec/NestedGroups` cops. ([@koic])
|
47
|
+
|
48
|
+
## 3.0.2 (2024-07-02)
|
49
|
+
|
50
|
+
- Fix wrong autocorrect for `RSpec/ScatteredSetup` when hook contains heredoc. ([@earlopain])
|
51
|
+
- Fix false negative for `RSpec/PredicateMatcher` when expectation contains custom failure message. ([@earlopain])
|
52
|
+
- Facilitate the 3.0 upgrade flow with proper extracted cop messages. ([@jeppester])
|
53
|
+
|
54
|
+
## 3.0.1 (2024-06-11)
|
55
|
+
|
56
|
+
- Bump RuboCop requirement to +1.61. ([@ydah])
|
57
|
+
|
58
|
+
## 3.0.0 (2024-06-11)
|
59
|
+
|
60
|
+
- Remove extracted cops in `Capybara`, `FactoryBot` and `Rails` departments. ([@ydah])
|
61
|
+
- Remove `RuboCop::RSpec::Language::NodePattern`. ([@ydah])
|
62
|
+
- Remove `RSpec/FilePath` cop. ([@ydah])
|
63
|
+
- Remove `RSpec/Capybara/FeatureMethods` cop. If you are using this cop, change it to use `RSpec/Dialect`. ([@ydah])
|
64
|
+
- Add new `RSpec/MissingExpectationTargetMethod` cop. ([@krororo])
|
65
|
+
- Fix an error for `RSpec/ScatteredSetup` when one of the hooks is an empty block. ([@earlopain])
|
66
|
+
|
67
|
+
These previously pending cops are now enabled by default: `RSpec/BeEmpty`, `RSpec/BeEq`, `RSpec/BeNil`, `RSpec/ChangeByZero`, `RSpec/ClassCheck`, `RSpec/ContainExactly`, `RSpec/DuplicatedMetadata`, `RSpec/EmptyMetadata`, `RSpec/EmptyOutput`, `RSpec/Eq`, `RSpec/ExcessiveDocstringSpacing`, `RSpec/ExpectInLet`, `RSpec/IdenticalEqualityAssertion`, `RSpec/IndexedLet`, `RSpec/IsExpectedSpecify`, `RSpec/MatchArray`, `RSpec/MetadataStyle`, `RSpec/NoExpectationExample`, `RSpec/PendingWithoutReason`, `RSpec/ReceiveMessages`, `RSpec/RedundantAround`, `RSpec/RedundantPredicateMatcher`, `RSpec/RemoveConst`, `RSpec/RepeatedSubjectCall`, `RSpec/SkipBlockInsideExample`, `RSpec/SortMetadata`, `RSpec/SpecFilePathFormat`, `RSpec/SpecFilePathSuffix`, `RSpec/SubjectDeclaration`, `RSpec/UndescriptiveLiteralsDescription`, and `RSpec/VerifiedDoubleReference`.
|
68
|
+
|
69
|
+
Read more about how to upgrade in https://docs.rubocop.org/rubocop-rspec/upgrade_to_version_3.html
|
70
|
+
|
71
|
+
## 2.31.0 (2024-06-07)
|
72
|
+
|
73
|
+
- Support `AutoCorrect: contextual` option for LSP. ([@ydah])
|
74
|
+
|
75
|
+
## 2.30.0 (2024-06-03)
|
76
|
+
|
77
|
+
- Add new `RSpec/ExpectInLet` cop. ([@yasu551])
|
78
|
+
|
79
|
+
## 2.29.2 (2024-05-02)
|
80
|
+
|
81
|
+
- Fix beginless and endless range bug for RepeatedIncludeExample cop. ([@hasghari])
|
82
|
+
- Fix a false positive for `RSpec/RepeatedSubjectCall` when subject is used as argument to function call. ([@K-S-A])
|
83
|
+
|
5
84
|
## 2.29.1 (2024-04-05)
|
6
85
|
|
7
86
|
- Fix an error in the default configuration. ([@ydah])
|
@@ -26,7 +105,7 @@
|
|
26
105
|
- Add new `RSpec/IsExpectedSpecify` cop. ([@ydah])
|
27
106
|
- Add new `RSpec/RepeatedSubjectCall` cop. ([@drcapulet])
|
28
107
|
- Add support for `assert_true`, `assert_false`, `assert_not_equal`, `assert_not_nil`, `*_empty`, `*_predicate`, `*_kind_of`, `*_in_delta`, `*_match`, `*_instance_of` and `*_includes` assertions in `RSpec/Rails/MinitestAssertions`. ([@ydah], [@G-Rath])
|
29
|
-
- Support asserts with messages in `
|
108
|
+
- Support asserts with messages in `RSpec/BeEmpty`. ([@G-Rath])
|
30
109
|
- Fix a false positive for `RSpec/ExpectActual` when used with rspec-rails routing matchers. ([@naveg])
|
31
110
|
- Add configuration option `ResponseMethods` to `RSpec/Rails/HaveHttpStatus`. ([@ydah])
|
32
111
|
- Fix a false negative for `RSpec/DescribedClass` when class with constant. ([@ydah])
|
@@ -221,7 +300,7 @@
|
|
221
300
|
## 2.13.0 (2022-09-12)
|
222
301
|
|
223
302
|
- Fix `RSpec/FilePath` cop missing mismatched expanded namespace. ([@sl4vr])
|
224
|
-
- Add new `AllowConsecutiveOneLiners` (default true) option for `
|
303
|
+
- Add new `AllowConsecutiveOneLiners` (default true) option for `RSpec/EmptyLineAfterHook` cop. ([@ngouy])
|
225
304
|
- Add autocorrect support for `RSpec/EmptyExampleGroup`. ([@r7kamura])
|
226
305
|
- Fix `RSpec/ChangeByZero` with compound expressions using `&` or `|` operators. ([@BrianHawley])
|
227
306
|
- Add `RSpec/NoExpectationExample`. ([@r7kamura])
|
@@ -678,7 +757,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
678
757
|
## 1.13.0 (2017-03-07)
|
679
758
|
|
680
759
|
- Add repeated 'it' detection to `RSpec/ExampleWording` cop. ([@dgollahon])
|
681
|
-
- Add
|
760
|
+
- Add [observed_nesting/max_nesting] info to `RSpec/NestedGroups` messages. ([@dgollahon])
|
682
761
|
- Add `RSpec/ItBehavesLike` cop. ([@dgollahon])
|
683
762
|
- Add `RSpec/SharedContext` cop. ([@Darhazer])
|
684
763
|
- `RSpec/MultipleExpectations`: Count aggregate_failures block as single expectation. ([@Darhazer])
|
@@ -849,6 +928,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
849
928
|
|
850
929
|
<!-- Contributors (alphabetically) -->
|
851
930
|
|
931
|
+
[@aarestad]: https://github.com/aarestad
|
852
932
|
[@abrom]: https://github.com/abrom
|
853
933
|
[@ahukkanen]: https://github.com/ahukkanen
|
854
934
|
[@akiomik]: https://github.com/akiomik
|
@@ -866,9 +946,11 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
866
946
|
[@bquorning]: https://github.com/bquorning
|
867
947
|
[@brentwheeldon]: https://github.com/BrentWheeldon
|
868
948
|
[@brianhawley]: https://github.com/BrianHawley
|
949
|
+
[@cbliard]: https://github.com/cbliard
|
869
950
|
[@cfabianski]: https://github.com/cfabianski
|
870
951
|
[@clupprich]: https://github.com/clupprich
|
871
952
|
[@composerinteralia]: https://github.com/composerinteralia
|
953
|
+
[@corsonknowles]: https://github.com/corsonknowles
|
872
954
|
[@corydiamand]: https://github.com/corydiamand
|
873
955
|
[@darhazer]: https://github.com/Darhazer
|
874
956
|
[@daveworth]: https://github.com/daveworth
|
@@ -880,6 +962,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
880
962
|
[@drowze]: https://github.com/Drowze
|
881
963
|
[@dswij]: https://github.com/dswij
|
882
964
|
[@dvandersluis]: https://github.com/dvandersluis
|
965
|
+
[@earlopain]: https://github.com/earlopain
|
883
966
|
[@edgibbs]: https://github.com/edgibbs
|
884
967
|
[@eikes]: https://github.com/eikes
|
885
968
|
[@eitoball]: https://github.com/eitoball
|
@@ -895,25 +978,30 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
895
978
|
[@gsamokovarov]: https://github.com/gsamokovarov
|
896
979
|
[@harry-graham]: https://github.com/harry-graham
|
897
980
|
[@harrylewis]: https://github.com/harrylewis
|
981
|
+
[@hasghari]: https://github.com/hasghari
|
898
982
|
[@hosamaly]: https://github.com/hosamaly
|
899
983
|
[@ignaciovillaverde]: https://github.com/ignaciovillaverde
|
900
984
|
[@jaredbeck]: https://github.com/jaredbeck
|
901
985
|
[@jaredmoody]: https://github.com/jaredmoody
|
902
986
|
[@jdufresne]: https://github.com/jdufresne
|
903
987
|
[@jeffreyc]: https://github.com/jeffreyc
|
988
|
+
[@jeppester]: https://github.com/jeppester
|
904
989
|
[@jessieay]: https://github.com/jessieay
|
905
990
|
[@jfragoulis]: https://github.com/jfragoulis
|
906
991
|
[@johnny-miyake]: https://github.com/johnny-miyake
|
907
992
|
[@jojos003]: https://github.com/jojos003
|
908
993
|
[@jonatas]: https://github.com/jonatas
|
909
994
|
[@jtannas]: https://github.com/jtannas
|
995
|
+
[@k-s-a]: https://github.com/K-S-A
|
910
996
|
[@kellysutton]: https://github.com/kellysutton
|
911
997
|
[@koic]: https://github.com/koic
|
998
|
+
[@krororo]: https://github.com/krororo
|
912
999
|
[@kuahyeow]: https://github.com/kuahyeow
|
913
1000
|
[@lazycoder9]: https://github.com/lazycoder9
|
914
1001
|
[@leoarnold]: https://github.com/leoarnold
|
915
1002
|
[@liberatys]: https://github.com/Liberatys
|
916
1003
|
[@lokhi]: https://github.com/lokhi
|
1004
|
+
[@lovro-bikic]: https://github.com/lovro-bikic
|
917
1005
|
[@luke-hill]: https://github.com/luke-hill
|
918
1006
|
[@m-yamashita01]: https://github.com/M-Yamashita01
|
919
1007
|
[@marocchino]: https://github.com/marocchino
|
@@ -969,6 +1057,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
|
|
969
1057
|
[@twalpole]: https://github.com/twalpole
|
970
1058
|
[@vzvu3k6k]: https://github.com/vzvu3k6k
|
971
1059
|
[@walf443]: https://github.com/walf443
|
1060
|
+
[@yasu551]: https://github.com/yasu551
|
972
1061
|
[@ybiquitous]: https://github.com/ybiquitous
|
973
1062
|
[@ydah]: https://github.com/ydah
|
974
1063
|
[@yevhene]: https://github.com/yevhene
|
data/README.md
CHANGED
@@ -7,6 +7,15 @@
|
|
7
7
|
[RSpec](https://rspec.info/)-specific analysis for your projects, as an extension to
|
8
8
|
[RuboCop](https://github.com/rubocop/rubocop).
|
9
9
|
|
10
|
+
- [Installation](#installation)
|
11
|
+
- [Upgrading to RuboCop RSpec v3.x](#upgrading-to-rubocop-rspec-v3x)
|
12
|
+
- [Upgrading to RuboCop RSpec v2.x](#upgrading-to-rubocop-rspec-v2x)
|
13
|
+
- [Usage](#usage)
|
14
|
+
- [Documentation](#documentation)
|
15
|
+
- [The Cops](#the-cops)
|
16
|
+
- [Contributing](#contributing)
|
17
|
+
- [License](#license)
|
18
|
+
|
10
19
|
## Installation
|
11
20
|
|
12
21
|
Just install the `rubocop-rspec` gem
|
@@ -21,6 +30,10 @@ or if you use bundler put this in your `Gemfile`
|
|
21
30
|
gem 'rubocop-rspec', require: false
|
22
31
|
```
|
23
32
|
|
33
|
+
### Upgrading to RuboCop RSpec v3.x
|
34
|
+
|
35
|
+
Read all the details in our [Upgrade to Version 3.x](https://docs.rubocop.org/rubocop-rspec/3.0/upgrade_to_version_3.html) document.
|
36
|
+
|
24
37
|
### Upgrading to RuboCop RSpec v2.x
|
25
38
|
|
26
39
|
Read all the details in our [Upgrade to Version 2.x](https://docs.rubocop.org/rubocop-rspec/2.0/upgrade_to_version_2.html) document.
|
@@ -35,13 +48,13 @@ ways to do this:
|
|
35
48
|
Put this into your `.rubocop.yml`.
|
36
49
|
|
37
50
|
```yaml
|
38
|
-
|
51
|
+
plugins: rubocop-rspec
|
39
52
|
```
|
40
53
|
|
41
54
|
Alternatively, use the following array notation when specifying multiple extensions.
|
42
55
|
|
43
56
|
```yaml
|
44
|
-
|
57
|
+
plugins:
|
45
58
|
- rubocop-other-extension
|
46
59
|
- rubocop-rspec
|
47
60
|
```
|
@@ -49,17 +62,20 @@ require:
|
|
49
62
|
Now you can run `rubocop` and it will automatically load the RuboCop RSpec
|
50
63
|
cops together with the standard cops.
|
51
64
|
|
65
|
+
> [!NOTE]
|
66
|
+
> The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
|
67
|
+
|
52
68
|
### Command line
|
53
69
|
|
54
70
|
```bash
|
55
|
-
rubocop --
|
71
|
+
rubocop --plugin rubocop-rspec
|
56
72
|
```
|
57
73
|
|
58
74
|
### Rake task
|
59
75
|
|
60
76
|
```ruby
|
61
77
|
RuboCop::RakeTask.new do |task|
|
62
|
-
task.
|
78
|
+
task.plugins << 'rubocop-rspec'
|
63
79
|
end
|
64
80
|
```
|
65
81
|
|
@@ -81,7 +97,7 @@ In your `.rubocop.yml`, you may treat the RSpec cops just like any other
|
|
81
97
|
cop. For example:
|
82
98
|
|
83
99
|
```yaml
|
84
|
-
RSpec/
|
100
|
+
RSpec/SpecFilePathFormat:
|
85
101
|
Exclude:
|
86
102
|
- spec/my_poorly_named_spec_file.rb
|
87
103
|
```
|