brew vendor-gems: commit updates.
This commit is contained in:
parent
9a23699369
commit
d241ebe3f1
@ -58,7 +58,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/pry-0.13.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/rdiscount-2.2.0.2"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rdiscount-2.2.0.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/regexp_parser-1.8.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/regexp_parser-2.0.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rexml-3.2.4/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ronn-0.7.3/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-support-3.10.0/lib"
|
||||
@ -72,11 +72,11 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-0.5.611
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-0.5.6111/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-sorbet-1.7.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.1.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.2.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.3.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.0.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.5.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.0/lib"
|
||||
|
@ -9,7 +9,11 @@ Performance/AncestorsInclude:
|
||||
|
||||
Performance/ArraySemiInfiniteRangeSlice:
|
||||
Description: 'Identifies places where slicing arrays with semi-infinite ranges can be replaced by `Array#take` and `Array#drop`.'
|
||||
Enabled: pending
|
||||
# This cop was created due to a mistake in microbenchmark.
|
||||
# Refer https://github.com/rubocop-hq/rubocop-performance/pull/175#issuecomment-731892717
|
||||
Enabled: false
|
||||
# Unsafe for string slices because strings do not have `#take` and `#drop` methods.
|
||||
Safe: false
|
||||
VersionAdded: '1.9'
|
||||
|
||||
Performance/BigDecimalWithNumericArgument:
|
@ -5,6 +5,9 @@ module RuboCop
|
||||
module Performance
|
||||
# This cop identifies places where slicing arrays with semi-infinite ranges
|
||||
# can be replaced by `Array#take` and `Array#drop`.
|
||||
# This cop was created due to a mistake in microbenchmark and hence is disabled by default.
|
||||
# Refer https://github.com/rubocop-hq/rubocop-performance/pull/175#issuecomment-731892717
|
||||
# This cop is also unsafe for string slices because strings do not have `#take` and `#drop` methods.
|
||||
#
|
||||
# @example
|
||||
# # bad
|
@ -29,38 +29,40 @@ module RuboCop
|
||||
# [1,2].first # => 1
|
||||
# [1,2].first(1) # => [1]
|
||||
#
|
||||
RETURN_NEW_ARRAY_WHEN_ARGS = ':first :last :pop :sample :shift '
|
||||
RETURN_NEW_ARRAY_WHEN_ARGS = %i[first last pop sample shift].to_set.freeze
|
||||
|
||||
# These methods return a new array only when called without a block.
|
||||
RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = ':zip :product '
|
||||
RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = %i[zip product].to_set.freeze
|
||||
|
||||
# These methods ALWAYS return a new array
|
||||
# after they're called it's safe to mutate the the resulting array
|
||||
ALWAYS_RETURNS_NEW_ARRAY = ':* :+ :- :collect :compact :drop '\
|
||||
':drop_while :flatten :map :reject ' \
|
||||
':reverse :rotate :select :shuffle :sort ' \
|
||||
':take :take_while :transpose :uniq ' \
|
||||
':values_at :| '
|
||||
ALWAYS_RETURNS_NEW_ARRAY = %i[* + - collect compact drop
|
||||
drop_while flatten map reject
|
||||
reverse rotate select shuffle sort
|
||||
take take_while transpose uniq
|
||||
values_at |].to_set.freeze
|
||||
|
||||
# These methods have a mutation alternative. For example :collect
|
||||
# can be called as :collect!
|
||||
HAS_MUTATION_ALTERNATIVE = ':collect :compact :flatten :map :reject '\
|
||||
':reverse :rotate :select :shuffle :sort '\
|
||||
':uniq '
|
||||
MSG = 'Use unchained `%<method>s!` and `%<second_method>s!` '\
|
||||
HAS_MUTATION_ALTERNATIVE = %i[collect compact flatten map reject
|
||||
reverse rotate select shuffle sort uniq].to_set.freeze
|
||||
|
||||
RETURNS_NEW_ARRAY = (ALWAYS_RETURNS_NEW_ARRAY + RETURNS_NEW_ARRAY_WHEN_NO_BLOCK).freeze
|
||||
|
||||
MSG = 'Use unchained `%<method>s` and `%<second_method>s!` '\
|
||||
'(followed by `return array` if required) instead of chaining '\
|
||||
'`%<method>s...%<second_method>s`.'
|
||||
|
||||
def_node_matcher :flat_map_candidate?, <<~PATTERN
|
||||
{
|
||||
(send (send _ ${#{RETURN_NEW_ARRAY_WHEN_ARGS}} {int lvar ivar cvar gvar}) ${#{HAS_MUTATION_ALTERNATIVE}} $...)
|
||||
(send (block (send _ ${#{ALWAYS_RETURNS_NEW_ARRAY} }) ...) ${#{HAS_MUTATION_ALTERNATIVE}} $...)
|
||||
(send (send _ ${#{ALWAYS_RETURNS_NEW_ARRAY + RETURNS_NEW_ARRAY_WHEN_NO_BLOCK}} ...) ${#{HAS_MUTATION_ALTERNATIVE}} $...)
|
||||
}
|
||||
def_node_matcher :chain_array_allocation?, <<~PATTERN
|
||||
(send {
|
||||
(send _ $%RETURN_NEW_ARRAY_WHEN_ARGS {int lvar ivar cvar gvar})
|
||||
(block (send _ $%ALWAYS_RETURNS_NEW_ARRAY) ...)
|
||||
(send _ $%RETURNS_NEW_ARRAY ...)
|
||||
} $%HAS_MUTATION_ALTERNATIVE ...)
|
||||
PATTERN
|
||||
|
||||
def on_send(node)
|
||||
flat_map_candidate?(node) do |fm, sm, _|
|
||||
chain_array_allocation?(node) do |fm, sm|
|
||||
range = range_between(node.loc.dot.begin_pos, node.source_range.end_pos)
|
||||
|
||||
add_offense(range, message: format(MSG, method: fm, second_method: sm))
|
@ -4,7 +4,7 @@ module RuboCop
|
||||
module Performance
|
||||
# This module holds the RuboCop Performance version information.
|
||||
module Version
|
||||
STRING = '1.9.0'
|
||||
STRING = '1.9.1'
|
||||
|
||||
def self.document_version
|
||||
STRING.match('\d+\.\d+').to_s
|
Loading…
x
Reference in New Issue
Block a user