Skip to content
Snippets Groups Projects
Unverified Commit d5aa9f8c authored by Nanda H Krishna's avatar Nanda H Krishna Committed by GitHub
Browse files

Merge pull request #11669 from...

Merge pull request #11669 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-performance-1.11.4

build(deps): bump rubocop-performance from 1.11.3 to 1.11.4 in /Library/Homebrew
parents 7c2a8f64 a7da26a2
No related branches found
No related tags found
No related merge requests found
Showing
with 100 additions and 183 deletions
......@@ -123,7 +123,7 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.7.0)
parser (>= 3.0.1.1)
rubocop-performance (1.11.3)
rubocop-performance (1.11.4)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.11.2)
......
......@@ -82,7 +82,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.7.0/lib
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.17.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.11.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"
......
......@@ -96,14 +96,18 @@ Performance/Count:
Performance/DeletePrefix:
Description: 'Use `delete_prefix` instead of `gsub`.'
Enabled: true
Safe: false
SafeMultiline: true
VersionAdded: '1.6'
VersionChanged: '1.11'
Performance/DeleteSuffix:
Description: 'Use `delete_suffix` instead of `gsub`.'
Enabled: true
Safe: false
SafeMultiline: true
VersionAdded: '1.6'
VersionChanged: '1.11'
Performance/Detect:
Description: >-
......
......@@ -11,11 +11,11 @@ module RuboCop
#
# @example
# # bad
# # array[..2]
# # array[...2]
# # array[2..]
# # array[2...]
# # array.slice(..2)
# array[..2]
# array[...2]
# array[2..]
# array[2...]
# array.slice(..2)
#
# # good
# array.take(3)
......
......@@ -58,10 +58,8 @@ module RuboCop
include RangeHelp
extend AutoCorrector
MSG = 'Reordering `when` conditions with a splat to the end ' \
'of the `when` branches can improve performance.'
ARRAY_MSG = 'Pass the contents of array literals ' \
'directly to `when` conditions.'
MSG = 'Reordering `when` conditions with a splat to the end of the `when` branches can improve performance.'
ARRAY_MSG = 'Pass the contents of array literals directly to `when` conditions.'
def on_case(case_node)
when_conditions = case_node.when_branches.flat_map(&:conditions)
......@@ -134,13 +132,11 @@ module RuboCop
end
def new_condition_with_then(node, new_condition)
"\n#{indent_for(node)}when " \
"#{new_condition} then #{node.body.source}"
"\n#{indent_for(node)}when #{new_condition} then #{node.body.source}"
end
def new_branch_without_then(node, new_condition)
"\n#{indent_for(node)}when #{new_condition}" \
"\n#{indent_for(node.body)}#{node.body.source}"
"\n#{indent_for(node)}when #{new_condition}\n#{indent_for(node.body)}#{node.body.source}"
end
def indent_for(node)
......
......@@ -33,7 +33,7 @@ module RuboCop
#
class CollectionLiteralInLoop < Base
MSG = 'Avoid immutable %<literal_class>s literals in loops. '\
'It is better to extract it into a local variable or a constant.'
'It is better to extract it into a local variable or a constant.'
POST_CONDITION_LOOP_TYPES = %i[while_post until_post].freeze
LOOP_TYPES = (POST_CONDITION_LOOP_TYPES + %i[while until for]).freeze
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment