lib/rubocop/cop/lint/unneeded_splat_expansion.rb in rubocop-0.68.1 vs lib/rubocop/cop/lint/unneeded_splat_expansion.rb in rubocop-0.69.0
- old
+ new
@@ -48,16 +48,16 @@
# bar
# else
# baz
# end
class UnneededSplatExpansion < Cop
- MSG = 'Replace splat expansion with comma separated values.'.freeze
- ARRAY_PARAM_MSG = 'Pass array contents as separate arguments.'.freeze
- PERCENT_W = '%w'.freeze
- PERCENT_CAPITAL_W = '%W'.freeze
- PERCENT_I = '%i'.freeze
- PERCENT_CAPITAL_I = '%I'.freeze
+ MSG = 'Replace splat expansion with comma separated values.'
+ ARRAY_PARAM_MSG = 'Pass array contents as separate arguments.'
+ PERCENT_W = '%w'
+ PERCENT_CAPITAL_W = '%W'
+ PERCENT_I = '%i'
+ PERCENT_CAPITAL_I = '%I'
ASSIGNMENT_TYPES = %i[lvasgn ivasgn cvasgn gvasgn].freeze
def_node_matcher :array_new?, '$(send (const nil? :Array) :new ...)'
def_node_matcher :literal_expansion, <<-PATTERN
@@ -139,10 +139,10 @@
def unneeded_brackets?(node)
parent = node.parent
grandparent = node.parent.parent
parent.when_type? || parent.send_type? || part_of_an_array?(node) ||
- (grandparent && grandparent.resbody_type?)
+ (grandparent&.resbody_type?)
end
def remove_brackets(array)
array_start = array.loc.begin.source
elements = *array