rubocop-rspec 2.0.0.pre → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -2
  3. data/README.md +7 -3
  4. data/config/default.yml +159 -73
  5. data/lib/rubocop-rspec.rb +8 -8
  6. data/lib/rubocop/cop/rspec/align_left_let_brace.rb +7 -3
  7. data/lib/rubocop/cop/rspec/align_right_let_brace.rb +7 -3
  8. data/lib/rubocop/cop/rspec/any_instance.rb +6 -10
  9. data/lib/rubocop/cop/rspec/around_block.rb +3 -1
  10. data/lib/rubocop/cop/rspec/base.rb +6 -55
  11. data/lib/rubocop/cop/rspec/be.rb +3 -2
  12. data/lib/rubocop/cop/rspec/be_eql.rb +2 -0
  13. data/lib/rubocop/cop/rspec/before_after_all.rb +6 -3
  14. data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +7 -2
  15. data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +6 -2
  16. data/lib/rubocop/cop/rspec/capybara/visibility_matcher.rb +4 -0
  17. data/lib/rubocop/cop/rspec/context_method.rb +1 -0
  18. data/lib/rubocop/cop/rspec/context_wording.rb +7 -1
  19. data/lib/rubocop/cop/rspec/describe_class.rb +5 -2
  20. data/lib/rubocop/cop/rspec/describe_method.rb +3 -2
  21. data/lib/rubocop/cop/rspec/describe_symbol.rb +2 -0
  22. data/lib/rubocop/cop/rspec/described_class.rb +6 -2
  23. data/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +3 -3
  24. data/lib/rubocop/cop/rspec/dialect.rb +2 -1
  25. data/lib/rubocop/cop/rspec/empty_example_group.rb +6 -45
  26. data/lib/rubocop/cop/rspec/empty_hook.rb +2 -1
  27. data/lib/rubocop/cop/rspec/empty_line_after_example.rb +1 -1
  28. data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +1 -1
  29. data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +1 -1
  30. data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +1 -1
  31. data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +2 -2
  32. data/lib/rubocop/cop/rspec/example_length.rb +26 -12
  33. data/lib/rubocop/cop/rspec/example_without_description.rb +1 -0
  34. data/lib/rubocop/cop/rspec/example_wording.rb +1 -0
  35. data/lib/rubocop/cop/rspec/expect_actual.rb +3 -1
  36. data/lib/rubocop/cop/rspec/expect_change.rb +3 -0
  37. data/lib/rubocop/cop/rspec/expect_in_hook.rb +2 -1
  38. data/lib/rubocop/cop/rspec/expect_output.rb +1 -1
  39. data/lib/rubocop/cop/rspec/factory_bot/attribute_defined_statically.rb +3 -0
  40. data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +4 -0
  41. data/lib/rubocop/cop/rspec/factory_bot/factory_class_name.rb +2 -0
  42. data/lib/rubocop/cop/rspec/file_path.rb +26 -17
  43. data/lib/rubocop/cop/rspec/focus.rb +46 -8
  44. data/lib/rubocop/cop/rspec/hook_argument.rb +4 -4
  45. data/lib/rubocop/cop/rspec/hooks_before_examples.rb +3 -2
  46. data/lib/rubocop/cop/rspec/implicit_block_expectation.rb +4 -0
  47. data/lib/rubocop/cop/rspec/implicit_expect.rb +2 -1
  48. data/lib/rubocop/cop/rspec/implicit_subject.rb +2 -0
  49. data/lib/rubocop/cop/rspec/instance_spy.rb +3 -1
  50. data/lib/rubocop/cop/rspec/instance_variable.rb +5 -1
  51. data/lib/rubocop/cop/rspec/it_behaves_like.rb +3 -1
  52. data/lib/rubocop/cop/rspec/iterated_expectation.rb +3 -1
  53. data/lib/rubocop/cop/rspec/let_before_examples.rb +3 -2
  54. data/lib/rubocop/cop/rspec/let_setup.rb +10 -4
  55. data/lib/rubocop/cop/rspec/message_chain.rb +4 -10
  56. data/lib/rubocop/cop/rspec/message_expectation.rb +3 -0
  57. data/lib/rubocop/cop/rspec/message_spies.rb +5 -3
  58. data/lib/rubocop/cop/rspec/mixin/comments_help.rb +38 -0
  59. data/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb +51 -0
  60. data/lib/rubocop/cop/rspec/mixin/final_end_location.rb +19 -0
  61. data/lib/rubocop/cop/rspec/mixin/top_level_group.rb +54 -0
  62. data/lib/rubocop/cop/rspec/mixin/variable.rb +21 -0
  63. data/lib/rubocop/cop/rspec/multiple_describes.rb +2 -3
  64. data/lib/rubocop/cop/rspec/multiple_expectations.rb +4 -1
  65. data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +3 -1
  66. data/lib/rubocop/cop/rspec/named_subject.rb +11 -12
  67. data/lib/rubocop/cop/rspec/nested_groups.rb +1 -1
  68. data/lib/rubocop/cop/rspec/not_to_not.rb +2 -0
  69. data/lib/rubocop/cop/rspec/overwriting_setup.rb +4 -1
  70. data/lib/rubocop/cop/rspec/pending.rb +17 -5
  71. data/lib/rubocop/cop/rspec/predicate_matcher.rb +8 -3
  72. data/lib/rubocop/cop/rspec/rails/http_status.rb +2 -0
  73. data/lib/rubocop/cop/rspec/receive_counts.rb +4 -0
  74. data/lib/rubocop/cop/rspec/receive_never.rb +2 -0
  75. data/lib/rubocop/cop/rspec/repeated_example_group_body.rb +8 -1
  76. data/lib/rubocop/cop/rspec/repeated_example_group_description.rb +4 -0
  77. data/lib/rubocop/cop/rspec/repeated_include_example.rb +6 -2
  78. data/lib/rubocop/cop/rspec/return_from_stub.rb +6 -0
  79. data/lib/rubocop/cop/rspec/scattered_setup.rb +1 -1
  80. data/lib/rubocop/cop/rspec/shared_context.rb +22 -11
  81. data/lib/rubocop/cop/rspec/shared_examples.rb +4 -1
  82. data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +4 -1
  83. data/lib/rubocop/cop/rspec/stubbed_mock.rb +2 -1
  84. data/lib/rubocop/cop/rspec/subject_stub.rb +17 -6
  85. data/lib/rubocop/cop/rspec/unspecified_exception.rb +2 -0
  86. data/lib/rubocop/cop/rspec/variable_definition.rb +1 -1
  87. data/lib/rubocop/cop/rspec/variable_name.rb +1 -1
  88. data/lib/rubocop/cop/rspec/verified_doubles.rb +2 -0
  89. data/lib/rubocop/cop/rspec/void_expect.rb +3 -0
  90. data/lib/rubocop/cop/rspec/yield.rb +3 -0
  91. data/lib/rubocop/cop/rspec_cops.rb +0 -1
  92. data/lib/rubocop/rspec/align_let_brace.rb +1 -1
  93. data/lib/rubocop/rspec/concept.rb +2 -2
  94. data/lib/rubocop/rspec/config_formatter.rb +5 -3
  95. data/lib/rubocop/rspec/corrector/move_node.rb +7 -10
  96. data/lib/rubocop/rspec/example.rb +5 -0
  97. data/lib/rubocop/rspec/example_group.rb +15 -5
  98. data/lib/rubocop/rspec/hook.rb +2 -1
  99. data/lib/rubocop/rspec/inject.rb +4 -2
  100. data/lib/rubocop/rspec/language.rb +159 -115
  101. data/lib/rubocop/rspec/language/node_pattern.rb +7 -24
  102. data/lib/rubocop/rspec/node.rb +1 -1
  103. data/lib/rubocop/rspec/version.rb +1 -1
  104. metadata +27 -16
  105. data/lib/rubocop/cop/rspec/cop.rb +0 -10
  106. data/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +0 -41
  107. data/lib/rubocop/rspec.rb +0 -12
  108. data/lib/rubocop/rspec/empty_line_separation.rb +0 -48
  109. data/lib/rubocop/rspec/final_end_location.rb +0 -17
  110. data/lib/rubocop/rspec/top_level_describe.rb +0 -52
  111. data/lib/rubocop/rspec/top_level_group.rb +0 -57
  112. data/lib/rubocop/rspec/variable.rb +0 -16
@@ -3,32 +3,15 @@
3
3
  module RuboCop
4
4
  module RSpec
5
5
  module Language
6
- # Common node matchers used for matching against the rspec DSL
6
+ # Helper methods to detect RSpec DSL used with send and block
7
7
  module NodePattern
8
- extend RuboCop::NodePattern::Macros
8
+ def send_pattern(string)
9
+ "(send #rspec? #{string} ...)"
10
+ end
9
11
 
10
- def_node_matcher :rspec?, '{(const {nil? cbase} :RSpec) nil?}'
11
-
12
- def_node_matcher :example_group?, ExampleGroups::ALL.block_pattern
13
- def_node_matcher :shared_group?, SharedGroups::ALL.block_pattern
14
-
15
- spec_groups = ExampleGroups::ALL + SharedGroups::ALL
16
- def_node_matcher :spec_group?, spec_groups.block_pattern
17
-
18
- def_node_matcher :example_group_with_body?, <<-PATTERN
19
- (block #{ExampleGroups::ALL.send_pattern} args !nil?)
20
- PATTERN
21
-
22
- def_node_matcher :example?, Examples::ALL.block_pattern
23
-
24
- def_node_matcher :hook?, Hooks::ALL.block_pattern
25
-
26
- def_node_matcher :let?, Helpers::ALL.block_or_block_pass_pattern
27
-
28
- def_node_matcher :include?,
29
- Includes::ALL.send_or_block_or_block_pass_pattern
30
-
31
- def_node_matcher :subject?, Subject::ALL.block_pattern
12
+ def block_pattern(string)
13
+ "(block #{send_pattern(string)} ...)"
14
+ end
32
15
  end
33
16
  end
34
17
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module RuboCop
4
4
  module RSpec
5
- # RuboCop-RSpec specific extensions of RuboCop::AST::Node
5
+ # RuboCop RSpec specific extensions of RuboCop::AST::Node
6
6
  module Node
7
7
  # In various cops we want to regard const as literal althought it's not
8
8
  # strictly literal.
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module RSpec
5
5
  # Version information for the RSpec RuboCop plugin.
6
6
  module Version
7
- STRING = '2.0.0.pre'
7
+ STRING = '2.3.0'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Backus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-10-22 00:00:00.000000000 Z
13
+ date: 2021-04-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop
@@ -26,6 +26,20 @@ dependencies:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: '1.0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rubocop-ast
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 1.1.0
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.1.0
29
43
  - !ruby/object:Gem::Dependency
30
44
  name: rack
31
45
  requirement: !ruby/object:Gem::Requirement
@@ -142,7 +156,6 @@ files:
142
156
  - lib/rubocop/cop/rspec/capybara/visibility_matcher.rb
143
157
  - lib/rubocop/cop/rspec/context_method.rb
144
158
  - lib/rubocop/cop/rspec/context_wording.rb
145
- - lib/rubocop/cop/rspec/cop.rb
146
159
  - lib/rubocop/cop/rspec/describe_class.rb
147
160
  - lib/rubocop/cop/rspec/describe_method.rb
148
161
  - lib/rubocop/cop/rspec/describe_symbol.rb
@@ -175,7 +188,6 @@ files:
175
188
  - lib/rubocop/cop/rspec/implicit_subject.rb
176
189
  - lib/rubocop/cop/rspec/instance_spy.rb
177
190
  - lib/rubocop/cop/rspec/instance_variable.rb
178
- - lib/rubocop/cop/rspec/invalid_predicate_matcher.rb
179
191
  - lib/rubocop/cop/rspec/it_behaves_like.rb
180
192
  - lib/rubocop/cop/rspec/iterated_expectation.rb
181
193
  - lib/rubocop/cop/rspec/leading_subject.rb
@@ -186,6 +198,11 @@ files:
186
198
  - lib/rubocop/cop/rspec/message_expectation.rb
187
199
  - lib/rubocop/cop/rspec/message_spies.rb
188
200
  - lib/rubocop/cop/rspec/missing_example_group_argument.rb
201
+ - lib/rubocop/cop/rspec/mixin/comments_help.rb
202
+ - lib/rubocop/cop/rspec/mixin/empty_line_separation.rb
203
+ - lib/rubocop/cop/rspec/mixin/final_end_location.rb
204
+ - lib/rubocop/cop/rspec/mixin/top_level_group.rb
205
+ - lib/rubocop/cop/rspec/mixin/variable.rb
189
206
  - lib/rubocop/cop/rspec/multiple_describes.rb
190
207
  - lib/rubocop/cop/rspec/multiple_expectations.rb
191
208
  - lib/rubocop/cop/rspec/multiple_memoized_helpers.rb
@@ -219,32 +236,26 @@ files:
219
236
  - lib/rubocop/cop/rspec/void_expect.rb
220
237
  - lib/rubocop/cop/rspec/yield.rb
221
238
  - lib/rubocop/cop/rspec_cops.rb
222
- - lib/rubocop/rspec.rb
223
239
  - lib/rubocop/rspec/align_let_brace.rb
224
240
  - lib/rubocop/rspec/concept.rb
225
241
  - lib/rubocop/rspec/config_formatter.rb
226
242
  - lib/rubocop/rspec/corrector/move_node.rb
227
243
  - lib/rubocop/rspec/description_extractor.rb
228
- - lib/rubocop/rspec/empty_line_separation.rb
229
244
  - lib/rubocop/rspec/example.rb
230
245
  - lib/rubocop/rspec/example_group.rb
231
246
  - lib/rubocop/rspec/factory_bot.rb
232
- - lib/rubocop/rspec/final_end_location.rb
233
247
  - lib/rubocop/rspec/hook.rb
234
248
  - lib/rubocop/rspec/inject.rb
235
249
  - lib/rubocop/rspec/language.rb
236
250
  - lib/rubocop/rspec/language/node_pattern.rb
237
251
  - lib/rubocop/rspec/node.rb
238
- - lib/rubocop/rspec/top_level_describe.rb
239
- - lib/rubocop/rspec/top_level_group.rb
240
- - lib/rubocop/rspec/variable.rb
241
252
  - lib/rubocop/rspec/version.rb
242
253
  - lib/rubocop/rspec/wording.rb
243
- homepage: https://github.com/rubocop-hq/rubocop-rspec
254
+ homepage: https://github.com/rubocop/rubocop-rspec
244
255
  licenses:
245
256
  - MIT
246
257
  metadata:
247
- changelog_uri: https://github.com/rubocop-hq/rubocop-rspec/blob/master/CHANGELOG.md
258
+ changelog_uri: https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md
248
259
  documentation_uri: https://docs.rubocop.org/rubocop-rspec/
249
260
  post_install_message:
250
261
  rdoc_options: []
@@ -254,14 +265,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
254
265
  requirements:
255
266
  - - ">="
256
267
  - !ruby/object:Gem::Version
257
- version: 2.4.0
268
+ version: 2.5.0
258
269
  required_rubygems_version: !ruby/object:Gem::Requirement
259
270
  requirements:
260
- - - ">"
271
+ - - ">="
261
272
  - !ruby/object:Gem::Version
262
- version: 1.3.1
273
+ version: '0'
263
274
  requirements: []
264
- rubygems_version: 3.0.3
275
+ rubygems_version: 3.2.16
265
276
  signing_key:
266
277
  specification_version: 4
267
278
  summary: Code style checking for RSpec files
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module RSpec
6
- # @deprecated Use ::RuboCop::Cop::RSpec::Base instead
7
- Cop = Base
8
- end
9
- end
10
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module RSpec
6
- # Checks invalid usage for predicate matcher.
7
- #
8
- # Predicate matcher does not need a question.
9
- # This cop checks an unnecessary question in predicate matcher.
10
- #
11
- # @example
12
- #
13
- # # bad
14
- # expect(foo).to be_something?
15
- #
16
- # # good
17
- # expect(foo).to be_something
18
- class InvalidPredicateMatcher < Base
19
- MSG = 'Omit `?` from `%<matcher>s`.'
20
-
21
- def_node_matcher :invalid_predicate_matcher?, <<-PATTERN
22
- (send (send nil? :expect ...) #{Runners::ALL.node_pattern_union} $(send nil? #predicate?))
23
- PATTERN
24
-
25
- def on_send(node)
26
- invalid_predicate_matcher?(node) do |predicate|
27
- add_offense(predicate,
28
- message: format(MSG, matcher: predicate.method_name))
29
- end
30
- end
31
-
32
- private
33
-
34
- def predicate?(name)
35
- name = name.to_s
36
- name.start_with?('be_', 'have_') && name.end_with?('?')
37
- end
38
- end
39
- end
40
- end
41
- end
data/lib/rubocop/rspec.rb DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- # RuboCop RSpec project namespace
5
- module RSpec
6
- PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
7
- CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
8
- CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
9
-
10
- private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
11
- end
12
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module RSpec
5
- # Helps determine the offending location if there is not an empty line
6
- # following the node. Allows comments to follow directly after.
7
- module EmptyLineSeparation
8
- include FinalEndLocation
9
- include RuboCop::Cop::RangeHelp
10
-
11
- def missing_separating_line_offense(node)
12
- return if last_child?(node)
13
-
14
- missing_separating_line(node) do |location|
15
- msg = yield(node.method_name)
16
- add_offense(location, message: msg) do |corrector|
17
- corrector.insert_after(location.end, "\n")
18
- end
19
- end
20
- end
21
-
22
- def missing_separating_line(node)
23
- line = final_end_location(node).line
24
-
25
- line += 1 while comment_line?(processed_source[line])
26
-
27
- return if processed_source[line].blank?
28
-
29
- yield offending_loc(line)
30
- end
31
-
32
- def offending_loc(last_line)
33
- offending_line = processed_source[last_line - 1]
34
-
35
- content_length = offending_line.lstrip.length
36
- start = offending_line.length - content_length
37
-
38
- source_range(processed_source.buffer, last_line, start, content_length)
39
- end
40
-
41
- def last_child?(node)
42
- return true unless node.parent&.begin_type?
43
-
44
- node.equal?(node.parent.children.last)
45
- end
46
- end
47
- end
48
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module RSpec
5
- # Helps find the true end location of nodes which might contain heredocs.
6
- module FinalEndLocation
7
- def final_end_location(start_node)
8
- heredoc_endings =
9
- start_node.each_node(:str, :dstr, :xstr)
10
- .select(&:heredoc?)
11
- .map { |node| node.loc.heredoc_end }
12
-
13
- [start_node.loc.end, *heredoc_endings].max_by(&:line)
14
- end
15
- end
16
- end
17
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module RSpec
5
- # Helper methods for top level describe cops
6
- module TopLevelDescribe
7
- extend NodePattern::Macros
8
-
9
- def on_send(node)
10
- return unless respond_to?(:on_top_level_describe)
11
- return unless top_level_describe?(node)
12
-
13
- on_top_level_describe(node, node.arguments)
14
- end
15
-
16
- private
17
-
18
- def top_level_describe?(node)
19
- return false unless node.method?(:describe)
20
-
21
- top_level_nodes.include?(node)
22
- end
23
-
24
- def top_level_nodes
25
- nodes = describe_statement_children(root_node)
26
- # If we have no top level describe statements, we need to check any
27
- # blocks on the top level (e.g. after a require).
28
- if nodes.empty?
29
- nodes = root_node.each_child_node(:block).flat_map do |child|
30
- describe_statement_children(child)
31
- end
32
- end
33
-
34
- nodes
35
- end
36
-
37
- def root_node
38
- processed_source.ast
39
- end
40
-
41
- def single_top_level_describe?
42
- top_level_nodes.one?
43
- end
44
-
45
- def describe_statement_children(node)
46
- node.each_child_node(:send).select do |element|
47
- element.method?(:describe)
48
- end
49
- end
50
- end
51
- end
52
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module RSpec
5
- # Helper methods for top level example group cops
6
- module TopLevelGroup
7
- extend RuboCop::NodePattern::Macros
8
- include RuboCop::RSpec::Language
9
-
10
- def_node_matcher :example_or_shared_group?,
11
- (ExampleGroups::ALL + SharedGroups::ALL).block_pattern
12
-
13
- def on_new_investigation
14
- super
15
-
16
- return unless root_node
17
-
18
- top_level_groups.each do |node|
19
- on_top_level_example_group(node) if example_group?(node)
20
- on_top_level_group(node)
21
- end
22
- end
23
-
24
- def top_level_groups
25
- @top_level_groups ||=
26
- top_level_nodes(root_node).select { |n| example_or_shared_group?(n) }
27
- end
28
-
29
- private
30
-
31
- # Dummy methods to be overridden in the consumer
32
- def on_top_level_example_group(_node); end
33
-
34
- def on_top_level_group(_node); end
35
-
36
- def top_level_group?(node)
37
- top_level_groups.include?(node)
38
- end
39
-
40
- def top_level_nodes(node)
41
- if node.nil?
42
- []
43
- elsif node.begin_type?
44
- node.children
45
- elsif node.module_type? || node.class_type?
46
- top_level_nodes(node.body)
47
- else
48
- [node]
49
- end
50
- end
51
-
52
- def root_node
53
- processed_source.ast
54
- end
55
- end
56
- end
57
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module RSpec
5
- # Helps check offenses with variable definitions
6
- module Variable
7
- include Language
8
- extend RuboCop::NodePattern::Macros
9
-
10
- def_node_matcher :variable_definition?, <<~PATTERN
11
- (send nil? #{(Helpers::ALL + Subject::ALL).node_pattern_union}
12
- $({sym str dsym dstr} ...) ...)
13
- PATTERN
14
- end
15
- end
16
- end