Skip to content

Commit

Permalink
Autocorrect Performance/StringIdentifierArgument
Browse files Browse the repository at this point in the history
... RuboCop offenses
  • Loading branch information
eduardoj committed Dec 18, 2023
1 parent 38c3d63 commit 11b88b4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
8 changes: 0 additions & 8 deletions src/api/.rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -577,14 +577,6 @@ Naming/VariableNumber:
- 'test/functional/source_controller_test.rb'
- 'test/unit/project_test.rb'

# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
Performance/StringIdentifierArgument:
Exclude:
- 'app/helpers/flag_helper.rb'
- 'app/models/bs_request_action.rb'
- 'app/models/event_subscription/find_for_event.rb'

# Offense count: 57
RSpec/AnyInstance:
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/helpers/flag_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def self.render(my_model, xml)
FlagHelper.flag_types.each do |flag_name|
next unless flags_sorted.key?(flag_name)

xml.send("#{flag_name}_") do # avoid class with 'build' function
xml.send(:"#{flag_name}_") do # avoid class with 'build' function
flags_sorted[flag_name].each { |flag| flag.to_xml(xml) }
end
end
Expand Down
6 changes: 3 additions & 3 deletions src/api/app/models/bs_request_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def is_maintenance_incident?
end

def matches_package?(source_or_target, pkg)
send("#{source_or_target}_project") == pkg.project.name && send("#{source_or_target}_package") == pkg.name
send(:"#{source_or_target}_project") == pkg.project.name && send(:"#{source_or_target}_package") == pkg.name
end

def is_from_remote?
Expand Down Expand Up @@ -178,9 +178,9 @@ def store_from_xml(hash)

def xml_package_attributes(source_or_target)
attributes = {}
value = send("#{source_or_target}_project")
value = send(:"#{source_or_target}_project")
attributes[:project] = value if value.present?
value = send("#{source_or_target}_package")
value = send(:"#{source_or_target}_package")
attributes[:package] = value if value.present?
attributes
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/event_subscription/find_for_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def subscriptions(channel = :instant_email)

event.class.receiver_roles.each do |receiver_role|
# Find the users/groups who are receivers for this event
receivers_before_expand = event.send("#{receiver_role}s")
receivers_before_expand = event.send(:"#{receiver_role}s")
next if receivers_before_expand.blank?

puts "Looking at #{receivers_before_expand.map(&:to_s).join(', ')} for '#{receiver_role}' and channel '#{channel}'" if @debug
Expand Down

0 comments on commit 11b88b4

Please sign in to comment.