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 6
6
# Note that changes in the inspected code, or installation of new
7
7
# versions of RuboCop, may require this file to be generated again.
8
8
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
-
21
9
# This cop supports safe autocorrection (--autocorrect).
22
10
InternalAffairs/NodeTypeMultiplePredicates :
23
11
Exclude :
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ class DescribedClass < Base # rubocop:disable Metrics/ClassLength
83
83
84
84
# @!method rspec_block?(node)
85
85
def_node_matcher :rspec_block? ,
86
- '({block numblock} (send #rspec? #ALL.all ...) ...)'
86
+ '(any_block (send #rspec? #ALL.all ...) ...)'
87
87
88
88
# @!method scope_changing_syntax?(node)
89
89
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
24
24
25
25
# @!method include_rspec_blocks?(node)
26
26
def_node_search :include_rspec_blocks? , <<~PATTERN
27
- ({block numblock} (send #explicit_rspec? #ExampleGroups.all ...) ...)
27
+ (any_block (send #explicit_rspec? #ExampleGroups.all ...) ...)
28
28
PATTERN
29
29
30
30
def on_module ( node )
Original file line number Diff line number Diff line change @@ -67,12 +67,12 @@ class HookArgument < Base
67
67
68
68
# @!method scoped_hook(node)
69
69
def_node_matcher :scoped_hook , <<~PATTERN
70
- ({block numblock} $(send _ #Hooks.all (sym ${:each :example})) ...)
70
+ (any_block $(send _ #Hooks.all (sym ${:each :example})) ...)
71
71
PATTERN
72
72
73
73
# @!method unscoped_hook(node)
74
74
def_node_matcher :unscoped_hook , <<~PATTERN
75
- ({block numblock} $(send _ #Hooks.all) ...)
75
+ (any_block $(send _ #Hooks.all) ...)
76
76
PATTERN
77
77
78
78
def on_block ( node )
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class HooksBeforeExamples < Base
30
30
# @!method example_or_group?(node)
31
31
def_node_matcher :example_or_group? , <<~PATTERN
32
32
{
33
- ({block numblock} {
33
+ (any_block {
34
34
(send #rspec? #ExampleGroups.all ...)
35
35
(send nil? #Examples.all ...)
36
36
} ...)
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ class NoExpectationExample < Base
65
65
# @param [RuboCop::AST::Node] node
66
66
# @return [Boolean]
67
67
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} ...) ...)
69
69
PATTERN
70
70
71
71
# @!method includes_expectation?(node)
Original file line number Diff line number Diff line change @@ -63,8 +63,7 @@ class PendingWithoutReason < Base
63
63
def_node_matcher :skipped_in_example? , <<~PATTERN
64
64
{
65
65
(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}) ...)
68
67
}
69
68
PATTERN
70
69
@@ -75,7 +74,7 @@ class PendingWithoutReason < Base
75
74
76
75
# @!method skipped_by_example_method_with_block?(node)
77
76
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} ...) ...)
79
78
PATTERN
80
79
81
80
# @!method metadata_without_reason?(node)
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def on_send(node)
41
41
42
42
# @!method match_redundant_around_hook_block?(node)
43
43
def_node_matcher :match_redundant_around_hook_block? , <<~PATTERN
44
- ({block numblock} (send _ :around ...) ... (send _ :run))
44
+ (any_block (send _ :around ...) ... (send _ :run))
45
45
PATTERN
46
46
47
47
# @!method match_redundant_around_hook_send?(node)
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class << self
26
26
27
27
# @!method example_group?(node)
28
28
def_node_matcher :example_group? , <<~PATTERN
29
- ({block numblock} (send #rspec? #ExampleGroups.all ...) ...)
29
+ (any_block (send #rspec? #ExampleGroups.all ...) ...)
30
30
PATTERN
31
31
32
32
# @!method shared_group?(node)
@@ -35,7 +35,7 @@ class << self
35
35
36
36
# @!method spec_group?(node)
37
37
def_node_matcher :spec_group? , <<~PATTERN
38
- ({block numblock} (send #rspec?
38
+ (any_block (send #rspec?
39
39
{#SharedGroups.all #ExampleGroups.all}
40
40
...) ...)
41
41
PATTERN
@@ -50,10 +50,7 @@ class << self
50
50
51
51
# @!method hook?(node)
52
52
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 ...) ...)
57
54
PATTERN
58
55
59
56
# @!method let?(node)
You can’t perform that action at this time.
0 commit comments