rubocop-rspec 1.44.0 → 2.1.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 +32 -1
- data/README.md +5 -1
- data/config/default.yml +170 -81
- data/lib/rubocop-rspec.rb +7 -8
- data/lib/rubocop/cop/rspec/align_left_let_brace.rb +7 -3
- data/lib/rubocop/cop/rspec/align_right_let_brace.rb +7 -3
- data/lib/rubocop/cop/rspec/around_block.rb +1 -1
- data/lib/rubocop/cop/rspec/base.rb +6 -55
- data/lib/rubocop/cop/rspec/be.rb +2 -2
- data/lib/rubocop/cop/rspec/before_after_all.rb +3 -3
- data/lib/rubocop/cop/rspec/capybara/current_path_expectation.rb +2 -2
- data/lib/rubocop/cop/rspec/capybara/feature_methods.rb +3 -2
- data/lib/rubocop/cop/rspec/describe_class.rb +2 -2
- data/lib/rubocop/cop/rspec/describe_method.rb +2 -2
- data/lib/rubocop/cop/rspec/described_class.rb +1 -2
- data/lib/rubocop/cop/rspec/described_class_module_wrapping.rb +1 -2
- data/lib/rubocop/cop/rspec/dialect.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_example_group.rb +6 -45
- data/lib/rubocop/cop/rspec/empty_hook.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_example.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_example_group.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_final_let.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_hook.rb +1 -1
- data/lib/rubocop/cop/rspec/empty_line_after_subject.rb +2 -2
- data/lib/rubocop/cop/rspec/expect_actual.rb +2 -1
- data/lib/rubocop/cop/rspec/expect_in_hook.rb +1 -1
- data/lib/rubocop/cop/rspec/expect_output.rb +1 -1
- data/lib/rubocop/cop/rspec/file_path.rb +24 -17
- data/lib/rubocop/cop/rspec/focus.rb +43 -8
- data/lib/rubocop/cop/rspec/hook_argument.rb +2 -4
- data/lib/rubocop/cop/rspec/hooks_before_examples.rb +2 -2
- data/lib/rubocop/cop/rspec/implicit_expect.rb +1 -1
- data/lib/rubocop/cop/rspec/instance_spy.rb +1 -1
- data/lib/rubocop/cop/rspec/instance_variable.rb +1 -1
- data/lib/rubocop/cop/rspec/it_behaves_like.rb +1 -1
- data/lib/rubocop/cop/rspec/iterated_expectation.rb +1 -1
- data/lib/rubocop/cop/rspec/let_before_examples.rb +2 -2
- data/lib/rubocop/cop/rspec/let_setup.rb +7 -4
- data/lib/rubocop/cop/rspec/message_spies.rb +3 -3
- data/lib/rubocop/cop/rspec/mixin/empty_line_separation.rb +51 -0
- data/lib/rubocop/cop/rspec/mixin/final_end_location.rb +19 -0
- data/lib/rubocop/cop/rspec/mixin/top_level_group.rb +54 -0
- data/lib/rubocop/cop/rspec/mixin/variable.rb +20 -0
- data/lib/rubocop/cop/rspec/multiple_describes.rb +2 -3
- data/lib/rubocop/cop/rspec/multiple_expectations.rb +1 -1
- data/lib/rubocop/cop/rspec/multiple_memoized_helpers.rb +3 -1
- data/lib/rubocop/cop/rspec/named_subject.rb +8 -12
- data/lib/rubocop/cop/rspec/nested_groups.rb +1 -1
- data/lib/rubocop/cop/rspec/overwriting_setup.rb +2 -1
- data/lib/rubocop/cop/rspec/pending.rb +13 -5
- data/lib/rubocop/cop/rspec/predicate_matcher.rb +3 -3
- data/lib/rubocop/cop/rspec/repeated_include_example.rb +3 -2
- data/lib/rubocop/cop/rspec/scattered_setup.rb +1 -1
- data/lib/rubocop/cop/rspec/shared_context.rb +18 -11
- data/lib/rubocop/cop/rspec/shared_examples.rb +3 -1
- data/lib/rubocop/cop/rspec/single_argument_message_chain.rb +1 -1
- data/lib/rubocop/cop/rspec/stubbed_mock.rb +1 -1
- data/lib/rubocop/cop/rspec/subject_stub.rb +16 -6
- data/lib/rubocop/cop/rspec/variable_definition.rb +1 -1
- data/lib/rubocop/cop/rspec/variable_name.rb +1 -1
- data/lib/rubocop/cop/rspec_cops.rb +0 -1
- data/lib/rubocop/rspec/align_let_brace.rb +1 -1
- data/lib/rubocop/rspec/concept.rb +2 -2
- data/lib/rubocop/rspec/config_formatter.rb +5 -3
- data/lib/rubocop/rspec/corrector/move_node.rb +1 -1
- data/lib/rubocop/rspec/example_group.rb +15 -5
- data/lib/rubocop/rspec/hook.rb +1 -1
- data/lib/rubocop/rspec/inject.rb +4 -2
- data/lib/rubocop/rspec/language.rb +143 -109
- data/lib/rubocop/rspec/language/node_pattern.rb +7 -24
- data/lib/rubocop/rspec/node.rb +1 -1
- data/lib/rubocop/rspec/version.rb +1 -1
- metadata +13 -17
- data/lib/rubocop/cop/rspec/cop.rb +0 -10
- data/lib/rubocop/cop/rspec/invalid_predicate_matcher.rb +0 -41
- data/lib/rubocop/rspec.rb +0 -12
- data/lib/rubocop/rspec/empty_line_separation.rb +0 -48
- data/lib/rubocop/rspec/final_end_location.rb +0 -17
- data/lib/rubocop/rspec/top_level_describe.rb +0 -52
- data/lib/rubocop/rspec/top_level_group.rb +0 -57
- data/lib/rubocop/rspec/variable.rb +0 -16
data/lib/rubocop-rspec.rb
CHANGED
@@ -5,26 +5,25 @@ require 'yaml'
|
|
5
5
|
|
6
6
|
require 'rubocop'
|
7
7
|
|
8
|
-
require_relative 'rubocop/rspec'
|
9
8
|
require_relative 'rubocop/rspec/version'
|
10
9
|
require_relative 'rubocop/rspec/inject'
|
11
10
|
require_relative 'rubocop/rspec/node'
|
12
|
-
require_relative 'rubocop/rspec/top_level_describe'
|
13
11
|
require_relative 'rubocop/rspec/wording'
|
14
|
-
require_relative 'rubocop/rspec/language'
|
15
12
|
require_relative 'rubocop/rspec/language/node_pattern'
|
16
|
-
require_relative 'rubocop/rspec/
|
13
|
+
require_relative 'rubocop/rspec/language'
|
14
|
+
|
15
|
+
require_relative 'rubocop/cop/rspec/mixin/top_level_group'
|
16
|
+
require_relative 'rubocop/cop/rspec/mixin/variable'
|
17
|
+
require_relative 'rubocop/cop/rspec/mixin/final_end_location'
|
18
|
+
require_relative 'rubocop/cop/rspec/mixin/empty_line_separation'
|
19
|
+
|
17
20
|
require_relative 'rubocop/rspec/concept'
|
18
21
|
require_relative 'rubocop/rspec/example_group'
|
19
22
|
require_relative 'rubocop/rspec/example'
|
20
23
|
require_relative 'rubocop/rspec/hook'
|
21
|
-
require_relative 'rubocop/rspec/variable'
|
22
24
|
require_relative 'rubocop/cop/rspec/base'
|
23
|
-
require_relative 'rubocop/cop/rspec/cop'
|
24
25
|
require_relative 'rubocop/rspec/align_let_brace'
|
25
26
|
require_relative 'rubocop/rspec/factory_bot'
|
26
|
-
require_relative 'rubocop/rspec/final_end_location'
|
27
|
-
require_relative 'rubocop/rspec/empty_line_separation'
|
28
27
|
require_relative 'rubocop/rspec/corrector/move_node'
|
29
28
|
|
30
29
|
RuboCop::RSpec::Inject.defaults!
|
@@ -27,11 +27,9 @@ module RuboCop
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def on_new_investigation
|
30
|
+
super
|
30
31
|
return if processed_source.blank?
|
31
32
|
|
32
|
-
token_aligner =
|
33
|
-
RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :begin)
|
34
|
-
|
35
33
|
token_aligner.offending_tokens.each do |let|
|
36
34
|
add_offense(let.loc.begin) do |corrector|
|
37
35
|
corrector.insert_before(
|
@@ -40,6 +38,12 @@ module RuboCop
|
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def token_aligner
|
45
|
+
RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :begin)
|
46
|
+
end
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
@@ -27,11 +27,9 @@ module RuboCop
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def on_new_investigation
|
30
|
+
super
|
30
31
|
return if processed_source.blank?
|
31
32
|
|
32
|
-
token_aligner =
|
33
|
-
RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :end)
|
34
|
-
|
35
33
|
token_aligner.offending_tokens.each do |let|
|
36
34
|
add_offense(let.loc.end) do |corrector|
|
37
35
|
corrector.insert_before(
|
@@ -40,6 +38,12 @@ module RuboCop
|
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def token_aligner
|
45
|
+
RuboCop::RSpec::AlignLetBrace.new(processed_source.ast, :end)
|
46
|
+
end
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
@@ -27,7 +27,7 @@ module RuboCop
|
|
27
27
|
# end
|
28
28
|
class AroundBlock < Base
|
29
29
|
MSG_NO_ARG = 'Test object should be passed to around block.'
|
30
|
-
MSG_UNUSED_ARG = 'You should call `%<arg>s.call` '\
|
30
|
+
MSG_UNUSED_ARG = 'You should call `%<arg>s.call` ' \
|
31
31
|
'or `%<arg>s.run`.'
|
32
32
|
|
33
33
|
def_node_matcher :hook, <<-PATTERN
|
@@ -4,30 +4,9 @@ module RuboCop
|
|
4
4
|
module Cop
|
5
5
|
module RSpec
|
6
6
|
# @abstract parent class to RSpec cops
|
7
|
-
#
|
8
|
-
# The criteria for whether rubocop-rspec analyzes a certain ruby file
|
9
|
-
# is configured via `AllCops/RSpec`. For example, if you want to
|
10
|
-
# customize your project to scan all files within a `test/` directory
|
11
|
-
# then you could add this to your configuration:
|
12
|
-
#
|
13
|
-
# @example configuring analyzed paths
|
14
|
-
# # .rubocop.yml
|
15
|
-
# # AllCops:
|
16
|
-
# # RSpec:
|
17
|
-
# # Patterns:
|
18
|
-
# # - '_test.rb$'
|
19
|
-
# # - '(?:^|/)test/'
|
20
7
|
class Base < ::RuboCop::Cop::Base
|
21
8
|
include RuboCop::RSpec::Language
|
22
|
-
|
23
|
-
|
24
|
-
DEFAULT_CONFIGURATION =
|
25
|
-
RuboCop::RSpec::CONFIG.fetch('AllCops').fetch('RSpec')
|
26
|
-
|
27
|
-
DEFAULT_PATTERN_RE = Regexp.union(
|
28
|
-
DEFAULT_CONFIGURATION.fetch('Patterns')
|
29
|
-
.map(&Regexp.public_method(:new))
|
30
|
-
)
|
9
|
+
extend RuboCop::RSpec::Language::NodePattern
|
31
10
|
|
32
11
|
exclude_from_registry
|
33
12
|
|
@@ -36,39 +15,11 @@ module RuboCop
|
|
36
15
|
RuboCop::Cop::Base.inherited(subclass)
|
37
16
|
end
|
38
17
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
def relevant_rubocop_rspec_file?(file)
|
46
|
-
rspec_pattern.match?(file)
|
47
|
-
end
|
48
|
-
|
49
|
-
def rspec_pattern
|
50
|
-
if rspec_pattern_config?
|
51
|
-
Regexp.union(rspec_pattern_config.map(&Regexp.public_method(:new)))
|
52
|
-
else
|
53
|
-
DEFAULT_PATTERN_RE
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def all_cops_config
|
58
|
-
config
|
59
|
-
.for_all_cops
|
60
|
-
end
|
61
|
-
|
62
|
-
def rspec_pattern_config?
|
63
|
-
return unless all_cops_config.key?('RSpec')
|
64
|
-
|
65
|
-
all_cops_config.fetch('RSpec').key?('Patterns')
|
66
|
-
end
|
67
|
-
|
68
|
-
def rspec_pattern_config
|
69
|
-
all_cops_config
|
70
|
-
.fetch('RSpec', DEFAULT_CONFIGURATION)
|
71
|
-
.fetch('Patterns')
|
18
|
+
# Set the config for dynamic DSL configuration-aware helpers
|
19
|
+
# that have no other means of accessing the configuration.
|
20
|
+
def on_new_investigation
|
21
|
+
super
|
22
|
+
RuboCop::RSpec::Language.config = config['RSpec']['Language']
|
72
23
|
end
|
73
24
|
end
|
74
25
|
end
|
data/lib/rubocop/cop/rspec/be.rb
CHANGED
@@ -20,10 +20,10 @@ module RuboCop
|
|
20
20
|
# expect(foo).to be(true)
|
21
21
|
#
|
22
22
|
class Be < Base
|
23
|
-
MSG =
|
23
|
+
MSG = "Don't use `be` without an argument."
|
24
24
|
|
25
25
|
def_node_matcher :be_without_args, <<-PATTERN
|
26
|
-
(send _ #
|
26
|
+
(send _ #Runners.all $(send nil? :be))
|
27
27
|
PATTERN
|
28
28
|
|
29
29
|
def on_send(node)
|
@@ -24,9 +24,9 @@ module RuboCop
|
|
24
24
|
# after(:each) { Widget.delete_all }
|
25
25
|
# end
|
26
26
|
class BeforeAfterAll < Base
|
27
|
-
MSG = 'Beware of using `%<hook>s` as it may cause state to leak '\
|
28
|
-
'between tests. If you are using `rspec-rails`, and '\
|
29
|
-
'`use_transactional_fixtures` is enabled, then records created '\
|
27
|
+
MSG = 'Beware of using `%<hook>s` as it may cause state to leak ' \
|
28
|
+
'between tests. If you are using `rspec-rails`, and ' \
|
29
|
+
'`use_transactional_fixtures` is enabled, then records created ' \
|
30
30
|
'in `%<hook>s` are not automatically rolled back.'
|
31
31
|
|
32
32
|
def_node_matcher :before_or_after_all, <<-PATTERN
|
@@ -37,13 +37,13 @@ module RuboCop
|
|
37
37
|
# Supported matchers: eq(...) / match(/regexp/) / match('regexp')
|
38
38
|
def_node_matcher :as_is_matcher, <<-PATTERN
|
39
39
|
(send
|
40
|
-
#expectation_set_on_current_path $#
|
40
|
+
#expectation_set_on_current_path $#Runners.all
|
41
41
|
${(send nil? :eq ...) (send nil? :match (regexp ...))})
|
42
42
|
PATTERN
|
43
43
|
|
44
44
|
def_node_matcher :regexp_str_matcher, <<-PATTERN
|
45
45
|
(send
|
46
|
-
#expectation_set_on_current_path $#
|
46
|
+
#expectation_set_on_current_path $#Runners.all
|
47
47
|
$(send nil? :match (str $_)))
|
48
48
|
PATTERN
|
49
49
|
|
@@ -55,8 +55,9 @@ module RuboCop
|
|
55
55
|
feature: :describe
|
56
56
|
}.freeze
|
57
57
|
|
58
|
-
def_node_matcher :capybara_speak,
|
59
|
-
|
58
|
+
def_node_matcher :capybara_speak, <<-PATTERN
|
59
|
+
{#{MAP.keys.map(&:inspect).join(' ')}}
|
60
|
+
PATTERN
|
60
61
|
|
61
62
|
def_node_matcher :spec?, <<-PATTERN
|
62
63
|
(block
|
@@ -35,9 +35,9 @@ module RuboCop
|
|
35
35
|
# describe "A feature example", type: :feature do
|
36
36
|
# end
|
37
37
|
class DescribeClass < Base
|
38
|
-
include
|
38
|
+
include TopLevelGroup
|
39
39
|
|
40
|
-
MSG = 'The first argument to describe should be '\
|
40
|
+
MSG = 'The first argument to describe should be ' \
|
41
41
|
'the class or module being tested.'
|
42
42
|
|
43
43
|
def_node_matcher :example_group_with_ignored_metadata?, <<~PATTERN
|
@@ -17,9 +17,9 @@ module RuboCop
|
|
17
17
|
# describe MyClass, '.my_class_method' do
|
18
18
|
# end
|
19
19
|
class DescribeMethod < Base
|
20
|
-
include
|
20
|
+
include TopLevelGroup
|
21
21
|
|
22
|
-
MSG = 'The second argument to describe should be the method '\
|
22
|
+
MSG = 'The second argument to describe should be the method ' \
|
23
23
|
"being tested. '#instance' or '.class'."
|
24
24
|
|
25
25
|
def_node_matcher :second_argument, <<~PATTERN
|
@@ -65,8 +65,7 @@ module RuboCop
|
|
65
65
|
(block (send (const nil? {:Class :Module :Struct}) :new ...) ...)
|
66
66
|
PATTERN
|
67
67
|
|
68
|
-
def_node_matcher :rspec_block?,
|
69
|
-
RuboCop::RSpec::Language::ALL.block_pattern
|
68
|
+
def_node_matcher :rspec_block?, block_pattern('#ALL.all')
|
70
69
|
|
71
70
|
def_node_matcher :scope_changing_syntax?, '{def class module}'
|
72
71
|
|
@@ -22,8 +22,7 @@ module RuboCop
|
|
22
22
|
class DescribedClassModuleWrapping < Base
|
23
23
|
MSG = 'Avoid opening modules and defining specs within them.'
|
24
24
|
|
25
|
-
def_node_search :find_rspec_blocks,
|
26
|
-
ExampleGroups::ALL.block_pattern
|
25
|
+
def_node_search :find_rspec_blocks, block_pattern('#ExampleGroups.all')
|
27
26
|
|
28
27
|
def on_module(node)
|
29
28
|
find_rspec_blocks(node) do
|
@@ -5,8 +5,6 @@ module RuboCop
|
|
5
5
|
module RSpec
|
6
6
|
# Checks if an example group does not include any tests.
|
7
7
|
#
|
8
|
-
# This cop is configurable using the `CustomIncludeMethods` option
|
9
|
-
#
|
10
8
|
# @example usage
|
11
9
|
#
|
12
10
|
# # bad
|
@@ -37,31 +35,6 @@ module RuboCop
|
|
37
35
|
# describe Bacon do
|
38
36
|
# pending 'will add tests later'
|
39
37
|
# end
|
40
|
-
#
|
41
|
-
# @example configuration
|
42
|
-
#
|
43
|
-
# # .rubocop.yml
|
44
|
-
# # RSpec/EmptyExampleGroup:
|
45
|
-
# # CustomIncludeMethods:
|
46
|
-
# # - include_tests
|
47
|
-
#
|
48
|
-
# # spec_helper.rb
|
49
|
-
# RSpec.configure do |config|
|
50
|
-
# config.alias_it_behaves_like_to(:include_tests)
|
51
|
-
# end
|
52
|
-
#
|
53
|
-
# # bacon_spec.rb
|
54
|
-
# describe Bacon do
|
55
|
-
# let(:bacon) { Bacon.new(chunkiness) }
|
56
|
-
# let(:chunkiness) { false }
|
57
|
-
#
|
58
|
-
# context 'extra chunky' do # not flagged by rubocop
|
59
|
-
# let(:chunkiness) { true }
|
60
|
-
#
|
61
|
-
# include_tests 'shared tests'
|
62
|
-
# end
|
63
|
-
# end
|
64
|
-
#
|
65
38
|
class EmptyExampleGroup < Base
|
66
39
|
MSG = 'Empty example group detected.'
|
67
40
|
|
@@ -76,7 +49,7 @@ module RuboCop
|
|
76
49
|
# @param node [RuboCop::AST::Node]
|
77
50
|
# @yield [RuboCop::AST::Node] example group body
|
78
51
|
def_node_matcher :example_group_body, <<~PATTERN
|
79
|
-
(block #{ExampleGroups
|
52
|
+
(block #{send_pattern('#ExampleGroups.all')} args $_)
|
80
53
|
PATTERN
|
81
54
|
|
82
55
|
# @!method example_or_group_or_include?(node)
|
@@ -95,12 +68,10 @@ module RuboCop
|
|
95
68
|
# @return [Array<RuboCop::AST::Node>] matching nodes
|
96
69
|
def_node_matcher :example_or_group_or_include?, <<~PATTERN
|
97
70
|
{
|
98
|
-
#{
|
99
|
-
|
100
|
-
|
101
|
-
#{Includes
|
102
|
-
#{Includes::ALL.block_pattern}
|
103
|
-
(send nil? #custom_include? ...)
|
71
|
+
#{block_pattern(
|
72
|
+
'{#Examples.all #ExampleGroups.all #Includes.all}'
|
73
|
+
)}
|
74
|
+
#{send_pattern('{#Examples.all #Includes.all}')}
|
104
75
|
}
|
105
76
|
PATTERN
|
106
77
|
|
@@ -120,7 +91,7 @@ module RuboCop
|
|
120
91
|
# @param node [RuboCop::AST::Node]
|
121
92
|
# @return [Array<RuboCop::AST::Node>] matching nodes
|
122
93
|
def_node_matcher :examples_inside_block?, <<~PATTERN
|
123
|
-
(block !#{Hooks
|
94
|
+
(block !#{send_pattern('#Hooks.all')} _ #examples?)
|
124
95
|
PATTERN
|
125
96
|
|
126
97
|
# @!method examples_directly_or_in_block?(node)
|
@@ -192,16 +163,6 @@ module RuboCop
|
|
192
163
|
def examples_in_branches?(if_node)
|
193
164
|
if_node.branches.any? { |branch| examples?(branch) }
|
194
165
|
end
|
195
|
-
|
196
|
-
def custom_include?(method_name)
|
197
|
-
custom_include_methods.include?(method_name)
|
198
|
-
end
|
199
|
-
|
200
|
-
def custom_include_methods
|
201
|
-
cop_config
|
202
|
-
.fetch('CustomIncludeMethods', [])
|
203
|
-
.map(&:to_sym)
|
204
|
-
end
|
205
166
|
end
|
206
167
|
end
|
207
168
|
end
|
@@ -16,7 +16,7 @@ module RuboCop
|
|
16
16
|
# let(:foo) { bar }
|
17
17
|
class EmptyLineAfterSubject < Base
|
18
18
|
extend AutoCorrector
|
19
|
-
include
|
19
|
+
include EmptyLineSeparation
|
20
20
|
|
21
21
|
MSG = 'Add an empty line after `%<subject>s`.'
|
22
22
|
|
@@ -32,7 +32,7 @@ module RuboCop
|
|
32
32
|
|
33
33
|
def in_spec_block?(node)
|
34
34
|
node.each_ancestor(:block).any? do |ancestor|
|
35
|
-
Examples
|
35
|
+
Examples.all(ancestor.method_name)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -48,7 +48,7 @@ module RuboCop
|
|
48
48
|
def_node_matcher :expect_literal, <<~PATTERN
|
49
49
|
(send
|
50
50
|
(send nil? :expect $#literal?)
|
51
|
-
#
|
51
|
+
#Runners.all
|
52
52
|
{
|
53
53
|
(send (send nil? $:be) :== $_)
|
54
54
|
(send nil? $_ $_ ...)
|
@@ -60,6 +60,7 @@ module RuboCop
|
|
60
60
|
expect_literal(node) do |actual, matcher, expected|
|
61
61
|
add_offense(actual.source_range) do |corrector|
|
62
62
|
next unless SUPPORTED_MATCHERS.include?(matcher)
|
63
|
+
next if literal?(expected)
|
63
64
|
|
64
65
|
swap(corrector, actual, expected)
|
65
66
|
end
|