File tree Expand file tree Collapse file tree 9 files changed +12
-28
lines changed
Expand file tree Collapse file tree 9 files changed +12
-28
lines changed Original file line number Diff line number Diff line change 66# Note that changes in the inspected code, or installation of new
77# versions of RuboCop, may require this file to be generated again.
88
9- # This cop supports safe autocorrection (--autocorrect).
10- InternalAffairs/NodePatternGroups :
11- Exclude :
12- - ' lib/rubocop/cop/rspec/described_class.rb'
13- - ' lib/rubocop/cop/rspec/described_class_module_wrapping.rb'
14- - ' lib/rubocop/cop/rspec/hook_argument.rb'
15- - ' lib/rubocop/cop/rspec/hooks_before_examples.rb'
16- - ' lib/rubocop/cop/rspec/no_expectation_example.rb'
17- - ' lib/rubocop/cop/rspec/pending_without_reason.rb'
18- - ' lib/rubocop/cop/rspec/redundant_around.rb'
19- - ' lib/rubocop/rspec/language.rb'
20-
219# This cop supports safe autocorrection (--autocorrect).
2210InternalAffairs/NodeTypeMultiplePredicates :
2311 Exclude :
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ class DescribedClass < Base # rubocop:disable Metrics/ClassLength
8383
8484 # @!method rspec_block?(node)
8585 def_node_matcher :rspec_block? ,
86- '({block numblock} (send #rspec? #ALL.all ...) ...)'
86+ '(any_block (send #rspec? #ALL.all ...) ...)'
8787
8888 # @!method scope_changing_syntax?(node)
8989 def_node_matcher :scope_changing_syntax? , '{def class module}'
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class DescribedClassModuleWrapping < Base
2424
2525 # @!method include_rspec_blocks?(node)
2626 def_node_search :include_rspec_blocks? , <<~PATTERN
27- ({block numblock} (send #explicit_rspec? #ExampleGroups.all ...) ...)
27+ (any_block (send #explicit_rspec? #ExampleGroups.all ...) ...)
2828 PATTERN
2929
3030 def on_module ( node )
Original file line number Diff line number Diff line change @@ -67,12 +67,12 @@ class HookArgument < Base
6767
6868 # @!method scoped_hook(node)
6969 def_node_matcher :scoped_hook , <<~PATTERN
70- ({block numblock} $(send _ #Hooks.all (sym ${:each :example})) ...)
70+ (any_block $(send _ #Hooks.all (sym ${:each :example})) ...)
7171 PATTERN
7272
7373 # @!method unscoped_hook(node)
7474 def_node_matcher :unscoped_hook , <<~PATTERN
75- ({block numblock} $(send _ #Hooks.all) ...)
75+ (any_block $(send _ #Hooks.all) ...)
7676 PATTERN
7777
7878 def on_block ( node )
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class HooksBeforeExamples < Base
3030 # @!method example_or_group?(node)
3131 def_node_matcher :example_or_group? , <<~PATTERN
3232 {
33- ({block numblock} {
33+ (any_block {
3434 (send #rspec? #ExampleGroups.all ...)
3535 (send nil? #Examples.all ...)
3636 } ...)
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ class NoExpectationExample < Base
6565 # @param [RuboCop::AST::Node] node
6666 # @return [Boolean]
6767 def_node_matcher :regular_or_focused_example? , <<~PATTERN
68- ({block numblock} (send nil? {#Examples.regular #Examples.focused} ...) ...)
68+ (any_block (send nil? {#Examples.regular #Examples.focused} ...) ...)
6969 PATTERN
7070
7171 # @!method includes_expectation?(node)
Original file line number Diff line number Diff line change @@ -63,8 +63,7 @@ class PendingWithoutReason < Base
6363 def_node_matcher :skipped_in_example? , <<~PATTERN
6464 {
6565 (send nil? ${#Examples.skipped #Examples.pending})
66- (block (send nil? ${#Examples.skipped}) ...)
67- (numblock (send nil? ${#Examples.skipped}) ...)
66+ (any_block (send nil? ${#Examples.skipped}) ...)
6867 }
6968 PATTERN
7069
@@ -75,7 +74,7 @@ class PendingWithoutReason < Base
7574
7675 # @!method skipped_by_example_method_with_block?(node)
7776 def_node_matcher :skipped_by_example_method_with_block? , <<~PATTERN
78- ({block numblock} (send nil? ${#Examples.skipped #Examples.pending} ...) ...)
77+ (any_block (send nil? ${#Examples.skipped #Examples.pending} ...) ...)
7978 PATTERN
8079
8180 # @!method metadata_without_reason?(node)
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def on_send(node)
4141
4242 # @!method match_redundant_around_hook_block?(node)
4343 def_node_matcher :match_redundant_around_hook_block? , <<~PATTERN
44- ({block numblock} (send _ :around ...) ... (send _ :run))
44+ (any_block (send _ :around ...) ... (send _ :run))
4545 PATTERN
4646
4747 # @!method match_redundant_around_hook_send?(node)
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class << self
2626
2727 # @!method example_group?(node)
2828 def_node_matcher :example_group? , <<~PATTERN
29- ({block numblock} (send #rspec? #ExampleGroups.all ...) ...)
29+ (any_block (send #rspec? #ExampleGroups.all ...) ...)
3030 PATTERN
3131
3232 # @!method shared_group?(node)
@@ -35,7 +35,7 @@ class << self
3535
3636 # @!method spec_group?(node)
3737 def_node_matcher :spec_group? , <<~PATTERN
38- ({block numblock} (send #rspec?
38+ (any_block (send #rspec?
3939 {#SharedGroups.all #ExampleGroups.all}
4040 ...) ...)
4141 PATTERN
@@ -50,10 +50,7 @@ class << self
5050
5151 # @!method hook?(node)
5252 def_node_matcher :hook? , <<~PATTERN
53- {
54- (numblock (send nil? #Hooks.all ...) ...)
55- (block (send nil? #Hooks.all ...) ...)
56- }
53+ (any_block (send nil? #Hooks.all ...) ...)
5754 PATTERN
5855
5956 # @!method let?(node)
You can’t perform that action at this time.
0 commit comments