Skip to content

Commit

Permalink
Use RuboCop Performance to 1.20
Browse files Browse the repository at this point in the history
```console
$ bundle exec rubocop
(snip)

lib/rubocop/cop/exclude_limit.rb:11:21: C: [Correctable] Performance/StringIdentifierArgument:
Use :"#{method_name}=" instead of "#{method_name}=".
      define_method("#{method_name}=") do |value|
                    ^^^^^^^^^^^^^^^^^
lib/rubocop/cop/style/conditional_assignment.rb:236:25: C: [Correctable] Performance/StringIdentifierArgument:
Use :"on_#{type}" instead of "on_#{type}".
          define_method "on_#{type}" do |node|
                        ^^^^^^^^^^^^
lib/rubocop/cop/style/numeric_literal_prefix.rb:65:32: C: [Correctable] Performance/StringIdentifierArgument:
Use :"#{literal_type(node).upcase}_MSG" instead of "#{literal_type(node).upcase}_MSG".
          self.class.const_get("#{literal_type(node).upcase}_MSG")
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/rubocop/lsp/routes.rb:20:23: C: [Correctable] Performance/StringIdentifierArgument:
Use :"handle_#{name}" instead of "handle_#{name}".
        define_method("handle_#{name}", &block)
                      ^^^^^^^^^^^^^^^^

1527 files inspected, 4 offenses detected, 4 offenses autocorrectable
```
  • Loading branch information
koic committed Dec 16, 2023
1 parent 58223eb commit 079dffa
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gem 'bundler', '>= 1.15.0', '< 3.0'
gem 'memory_profiler', platform: :mri
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.7'
gem 'rubocop-performance', '~> 1.19.0'
gem 'rubocop-performance', '~> 1.20.0'
gem 'rubocop-rake', '~> 0.6.0'
gem 'rubocop-rspec', '~> 2.25.0'
# Workaround for cc-test-reporter with SimpleCov 0.18.
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/exclude_limit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module ExcludeLimit
# The parameter name given is transformed into a method name (eg. `Max`
# becomes `self.max=` and `MinDigits` becomes `self.min_digits=`).
def exclude_limit(parameter_name, method_name: transform(parameter_name))
define_method("#{method_name}=") do |value|
define_method(:"#{method_name}=") do |value|
cfg = config_to_allow_offenses
cfg[:exclude_limit] ||= {}
current_max = cfg[:exclude_limit][parameter_name]
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/style/conditional_assignment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class ConditionalAssignment < Base
PATTERN

ASSIGNMENT_TYPES.each do |type|
define_method "on_#{type}" do |node|
define_method :"on_#{type}" do |node|
return if part_of_ignored_node?(node)
return if node.parent&.shorthand_asgn?

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/style/numeric_literal_prefix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def on_int(node)
private

def message(node)
self.class.const_get("#{literal_type(node).upcase}_MSG")
self.class.const_get(:"#{literal_type(node).upcase}_MSG")
end

def literal_type(node)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/lsp/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Lsp
# @api private
class Routes
def self.handle(name, &block)
define_method("handle_#{name}", &block)
define_method(:"handle_#{name}", &block)
end

private_class_method :handle
Expand Down

0 comments on commit 079dffa

Please sign in to comment.