Skip to content

Commit

Permalink
fix rubopcop offenses Performance/StringIdentifierArgument
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Dec 17, 2023
1 parent e133829 commit 1fe076b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/helpers/additionals_journals_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ def render_entity_journal_actions(entity, journal)
entity_type = entity.model_name.param_key

safe_join [link_to(l(:button_edit),
send("edit_#{entity_type}_journal_path", journal),
send(:"edit_#{entity_type}_journal_path", journal),
remote: true,
method: 'get',
title: l(:button_edit),
class: 'icon-only icon-edit'),
link_to(l(:button_delete),
send("#{entity_type}_journal_path", journal, journal: { notes: '' }),
send(:"#{entity_type}_journal_path", journal, journal: { notes: '' }),
remote: true,
method: 'put', data: { confirm: l(:text_are_you_sure) },
title: l(:button_delete),
Expand Down Expand Up @@ -123,7 +123,7 @@ def entity_show_detail(entity, detail, no_html = false, **options)
# rubocop: enable Style/OptionalBooleanParameter

def render_email_attributes(entry, html: false)
items = send "email_#{entry.class.name.underscore}_attributes", entry, html
items = send :"email_#{entry.class.name.underscore}_attributes", entry, html
if html
tag.ul class: 'details' do
items.map { |s| concat tag.li(s) }.join("\n")
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/additionals_queries_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def additionals_query_session_key(object_type)

def additionals_retrieve_query(object_type, user_filter: nil, search_string: nil)
session_key = additionals_query_session_key object_type
query_class = Object.const_get "#{object_type.camelcase}Query"
query_class = Object.const_get :"#{object_type.camelcase}Query"
if params[:query_id].present?
additionals_load_query_id query_class,
session_key,
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/dashboards_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def render_dashboard_block_content(block, block_definition, dashboard, **overwri
nil
end
else
send "render_#{block_definition[:name]}_block",
send :"render_#{block_definition[:name]}_block",
block,
block_definition,
settings,
Expand Down
4 changes: 2 additions & 2 deletions lib/additionals/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def memberships_new_issue_project_url(user, memberships, permission = :edit_issu
def additionals_library_load(module_names)
s = []
Array(module_names).each do |module_name|
s << send("additionals_load_#{module_name}")
s << send(:"additionals_load_#{module_name}")
end
safe_join s
end
Expand Down Expand Up @@ -147,7 +147,7 @@ def autocomplete_select_entries(name, type, option_tags, **options)
partial: 'additionals/select2_ajax_call',
formats: [:js],
locals: { field_name_id: sanitize_to_id(name),
ajax_url: send("#{type}_path", ajax_params),
ajax_url: send(:"#{type}_path", ajax_params),
options: options })
safe_join s
end
Expand Down
8 changes: 3 additions & 5 deletions test/global_test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,18 @@ def with_plugin_settings(plugin, settings, &_block)
end

def change_plugin_settings(plugin, settings)
instance_variable_set "@saved_#{plugin}_settings", Setting.send("plugin_#{plugin}").dup
new_settings = Setting.send("plugin_#{plugin}").dup
instance_variable_set :"@saved_#{plugin}_settings", Setting.send(:"plugin_#{plugin}").dup
new_settings = Setting.send(:"plugin_#{plugin}").dup
settings.each do |key, value|
new_settings[key] = value
end

Setting.send "plugin_#{plugin}=", new_settings
Setting.send :"plugin_#{plugin}=", new_settings
end

def restore_plugin_settings(plugin)
settings = instance_variable_get "@saved_#{plugin}_settings"
settings = instance_variable_get :"@saved_#{plugin}_settings"
if settings
Setting.send "plugin_#{plugin}=", settings
Setting.send :"plugin_#{plugin}=", settings
else
Rails.logger.warn "warning: restore_plugin_settings could not restore settings for #{plugin}"
Expand Down

0 comments on commit 1fe076b

Please sign in to comment.