Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fixes Performance/StringIdentifierArgument offenses

Klaus Zanders0ff0e80295b2
diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb
index 5279e218257..93963fb96c6 100644
--- a/app/controllers/watchers_controller.rb
+++ b/app/controllers/watchers_controller.rb
@@ -48,7 +48,7 @@ class WatchersController < ApplicationController
def find_watched_by_object
klass = params[:object_type].singularize.camelcase.constantize
- return false unless klass.respond_to?('watched_by') and
+ return false unless klass.respond_to?(:watched_by) and
klass.ancestors.include? Redmine::Acts::Watchable and
params[:object_id].to_s =~ /\A\d+\z/
diff --git a/app/helpers/errors_helper.rb b/app/helpers/errors_helper.rb
index 0dc3e7bf796..357055afe65 100644
--- a/app/helpers/errors_helper.rb
+++ b/app/helpers/errors_helper.rb
@@ -104,9 +104,9 @@ module ErrorsHelper
def unset_template_magic
if $ERROR_INFO.is_a?(ActionView::ActionViewError)
- @template.instance_variable_set('@project', nil)
- @template.instance_variable_set('@status', 500)
- @template.instance_variable_set('@message', message)
+ @template.instance_variable_set(:@project, nil)
+ @template.instance_variable_set(:@status, 500)
+ @template.instance_variable_set(:@message, message)
else
@project = nil
end
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index 39984c86dbb..bea11e81ce5 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -34,7 +34,7 @@ module WatchersHelper
options = options.with_indifferent_access
raise ArgumentError, 'Missing :replace option in options hash' if options['replace'].blank?
- return '' unless user&.logged? && object.respond_to?('watched_by?')
+ return '' unless user&.logged? && object.respond_to?(:watched_by?)
watched = object.watched_by?(user)
diff --git a/app/services/projects/delete_service.rb b/app/services/projects/delete_service.rb
index 24c515891c8..7cb24905205 100644
--- a/app/services/projects/delete_service.rb
+++ b/app/services/projects/delete_service.rb
@@ -49,7 +49,7 @@ module Projects
private
def before_perform(*)
- OpenProject::Notifications.send('project_deletion_imminent', project: @project_to_destroy)
+ OpenProject::Notifications.send(:project_deletion_imminent, project: @project_to_destroy)
delete_all_members
destroy_all_work_packages
diff --git a/app/uploaders/direct_fog_uploader.rb b/app/uploaders/direct_fog_uploader.rb
index 26405531203..ceeba259503 100644
--- a/app/uploaders/direct_fog_uploader.rb
+++ b/app/uploaders/direct_fog_uploader.rb
@@ -20,9 +20,9 @@ class DirectFogUploader < FogFileUploader
uploader = new
- uploader.instance_variable_set "@file", fog_file_uploader.file
- uploader.instance_variable_set "@key", fog_file_uploader.path
- uploader.instance_variable_set "@model", fog_file_uploader.model
+ uploader.instance_variable_set :@file, fog_file_uploader.file
+ uploader.instance_variable_set :@key, fog_file_uploader.path
+ uploader.instance_variable_set :@model, fog_file_uploader.model
uploader
end
diff --git a/config/initializers/06-pending_migrations_check.rb b/config/initializers/06-pending_migrations_check.rb
index d54b8756c9b..2c3735d611d 100644
--- a/config/initializers/06-pending_migrations_check.rb
+++ b/config/initializers/06-pending_migrations_check.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-is_console = Rails.const_defined? 'Console'
+is_console = Rails.const_defined? :Console
no_rake_task = !(Rake.respond_to?(:application) && Rake.application.top_level_tasks.present?)
no_override = ENV['OPENPROJECT_DISABLE__MIGRATIONS__CHECK'] != 'true'
diff --git a/lib/open_project/scm/adapters/local_client.rb b/lib/open_project/scm/adapters/local_client.rb
index f997322550e..8fe9173df88 100644
--- a/lib/open_project/scm/adapters/local_client.rb
+++ b/lib/open_project/scm/adapters/local_client.rb
@@ -125,7 +125,7 @@ module OpenProject
end
def supports_annotate?
- respond_to?('annotate')
+ respond_to?(:annotate)
end
def target(path = '')
diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb
index ed0e4b9982c..1e649f52d40 100644
--- a/lib/redmine/plugin.rb
+++ b/lib/redmine/plugin.rb
@@ -131,7 +131,7 @@ module Redmine # :nodoc:
end
def name(*args)
- name = args.empty? ? instance_variable_get("@name") : instance_variable_set("@name", *args)
+ name = args.empty? ? instance_variable_get(:@name) : instance_variable_set(:@name, *args)
return ::I18n.t(name) if name.is_a?(Symbol)
return name if name
@@ -141,7 +141,7 @@ module Redmine # :nodoc:
end
def description(*args)
- description = args.empty? ? instance_variable_get("@description") : instance_variable_set("@description", *args)
+ description = args.empty? ? instance_variable_get(:@description) : instance_variable_set(:@description, *args)
description || ::I18n.t("plugin_#{id}.description", default: gemspec&.description)
end
diff --git a/lib_static/plugins/acts_as_journalized/lib/journal_formatter/named_association.rb b/lib_static/plugins/acts_as_journalized/lib/journal_formatter/named_association.rb
index 30fd3dcc5c7..58026de529b 100644
--- a/lib_static/plugins/acts_as_journalized/lib/journal_formatter/named_association.rb
+++ b/lib_static/plugins/acts_as_journalized/lib/journal_formatter/named_association.rb
@@ -56,7 +56,7 @@ module JournalFormatter
if klass && value
record = associated_object(klass, value.to_i, cache:)
if record
- if record.respond_to? 'name'
+ if record.respond_to? :name
record.name
else
record.subject
diff --git a/modules/auth_saml/spec/lib/open_project/auth_saml_spec.rb b/modules/auth_saml/spec/lib/open_project/auth_saml_spec.rb
index 3152ea44e08..15e56eac81c 100644
--- a/modules/auth_saml/spec/lib/open_project/auth_saml_spec.rb
+++ b/modules/auth_saml/spec/lib/open_project/auth_saml_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe OpenProject::AuthSaml do
# the `configuration` method is cached to avoid
# loading the SAML file more than once
# thus remove any cached value here
- OpenProject::AuthSaml.remove_instance_variable('@saml_settings')
+ OpenProject::AuthSaml.remove_instance_variable(:@saml_settings)
OpenProject::AuthSaml.configuration
end
diff --git a/modules/backlogs/spec/models/story_spec.rb b/modules/backlogs/spec/models/story_spec.rb
index 967acf78aea..a49bb3173b6 100644
--- a/modules/backlogs/spec/models/story_spec.rb
+++ b/modules/backlogs/spec/models/story_spec.rb
@@ -137,7 +137,7 @@ RSpec.describe Story do
story2.version_id = version2.id
story2.project = other_project
# reset memoized versions to reflect changes above
- story2.instance_variable_set('@assignable_versions', nil)
+ story2.instance_variable_set(:@assignable_versions, nil)
story2.save!
end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
index 66688722038..f437012197d 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
@@ -90,7 +90,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
xml['d'].getcontenttype
xml['d'].getlastmodified
xml['oc'].permissions
- xml['oc'].send('owner-display-name')
+ xml['oc'].send(:"owner-display-name")
end
end
end.to_xml
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb
index 2ce10695d95..643204125af 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb
@@ -54,21 +54,21 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
) do
xml['d'].set do
xml['d'].prop do
- xml['nc'].send('acl-list') do
+ xml['nc'].send(:"acl-list") do
groups_permissions.each do |group, group_permissions|
xml['nc'].acl do
- xml['nc'].send('acl-mapping-type', 'group')
- xml['nc'].send('acl-mapping-id', group)
- xml['nc'].send('acl-mask', '31')
- xml['nc'].send('acl-permissions', group_permissions.to_s)
+ xml['nc'].send(:"acl-mapping-type", 'group')
+ xml['nc'].send(:"acl-mapping-id", group)
+ xml['nc'].send(:"acl-mask", '31')
+ xml['nc'].send(:"acl-permissions", group_permissions.to_s)
end
end
users_permissions.each do |user, user_permissions|
xml['nc'].acl do
- xml['nc'].send('acl-mapping-type', 'user')
- xml['nc'].send('acl-mapping-id', user)
- xml['nc'].send('acl-mask', '31')
- xml['nc'].send('acl-permissions', user_permissions.to_s)
+ xml['nc'].send(:"acl-mapping-type", 'user')
+ xml['nc'].send(:"acl-mapping-id", user)
+ xml['nc'].send(:"acl-mask", '31')
+ xml['nc'].send(:"acl-permissions", user_permissions.to_s)
end
end
end
diff --git a/modules/storages/spec/factories/webdav_data_factory.rb b/modules/storages/spec/factories/webdav_data_factory.rb
index c474c3634a8..6fb8e0cf6a9 100644
--- a/modules/storages/spec/factories/webdav_data_factory.rb
+++ b/modules/storages/spec/factories/webdav_data_factory.rb
@@ -55,7 +55,7 @@ FactoryBot.define do
xml['oc'].size('20028269')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:27:36 GMT')
xml['oc'].permissions('RGDNVCK')
- xml['oc'].send('owner-display-name', url_safe_user_id)
+ xml['oc'].send(:"owner-display-name", url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -74,7 +74,7 @@ FactoryBot.define do
xml['oc'].size('6592')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVCK')
- xml['oc'].send('owner-display-name', url_safe_user_id)
+ xml['oc'].send(:"owner-display-name", url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -93,7 +93,7 @@ FactoryBot.define do
xml['oc'].size('8592')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:43:26 GMT')
xml['oc'].permissions('RGDNV')
- xml['oc'].send('owner-display-name', url_safe_user_id)
+ xml['oc'].send(:"owner-display-name", url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -113,7 +113,7 @@ FactoryBot.define do
xml['d'].getcontenttype('text/markdown')
xml['d'].getlastmodified('Thu, 14 Jul 2022 08:42:15 GMT')
xml['oc'].permissions('RGDNVW')
- xml['oc'].send('owner-display-name', url_safe_user_id)
+ xml['oc'].send(:"owner-display-name", url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -127,7 +127,7 @@ FactoryBot.define do
xml['d'].getcontenttype('application/pdf')
xml['d'].getlastmodified('Thu, 14 Jul 2022 08:42:15 GMT')
xml['oc'].permissions('RGDNV')
- xml['oc'].send('owner-display-name', url_safe_user_id)
+ xml['oc'].send(:"owner-display-name", url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -156,7 +156,7 @@ FactoryBot.define do
xml['oc'].size('6592')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVCK')
- xml['oc'].send('owner-display-name', 'admin')
+ xml['oc'].send(:"owner-display-name", 'admin')
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -176,7 +176,7 @@ FactoryBot.define do
xml['d'].getcontenttype('image/png')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVW')
- xml['oc'].send('owner-display-name', 'admin')
+ xml['oc'].send(:"owner-display-name", 'admin')
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -190,7 +190,7 @@ FactoryBot.define do
xml['d'].getcontenttype('audio/ogg')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVW')
- xml['oc'].send('owner-display-name', 'admin')
+ xml['oc'].send(:"owner-display-name", 'admin')
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -204,7 +204,7 @@ FactoryBot.define do
xml['d'].getcontenttype('text/plain')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVW')
- xml['oc'].send('owner-display-name', 'admin')
+ xml['oc'].send(:"owner-display-name", 'admin')
end
xml['d'].status('HTTP/1.1 200 OK')
end
diff --git a/modules/xls_export/spec/lib/spreadsheet_builder_spec.rb b/modules/xls_export/spec/lib/spreadsheet_builder_spec.rb
index b5761857369..fce9c2122b7 100644
--- a/modules/xls_export/spec/lib/spreadsheet_builder_spec.rb
+++ b/modules/xls_export/spec/lib/spreadsheet_builder_spec.rb
@@ -77,9 +77,9 @@ RSpec.describe "SpreadsheetBuilder" do
it "alwayses use unix newlines" do
@spreadsheet.add_row(["Some text including a windows newline (\r\n)", "And an old-style mac os newline (\r)"])
2.times do |i|
- expect(@spreadsheet.send("raw_sheet").last_row[i]).not_to include("\r")
- expect(@spreadsheet.send("raw_sheet").last_row[i]).not_to include("\r\n")
- expect(@spreadsheet.send("raw_sheet").last_row[i]).to include("\n")
+ expect(@spreadsheet.send(:raw_sheet).last_row[i]).not_to include("\r")
+ expect(@spreadsheet.send(:raw_sheet).last_row[i]).not_to include("\r\n")
+ expect(@spreadsheet.send(:raw_sheet).last_row[i]).to include("\n")
end
end
end
diff --git a/spec/lib/open_project/logging/log_extender_spec.rb b/spec/lib/open_project/logging/log_extender_spec.rb
index 143513a3997..aabd3985f34 100644
--- a/spec/lib/open_project/logging/log_extender_spec.rb
+++ b/spec/lib/open_project/logging/log_extender_spec.rb
@@ -55,7 +55,7 @@ RSpec.describe OpenProject::Logging, 'Log extenders' do
end
after do
- described_class.instance_variable_set('@payload_extenders', nil)
+ described_class.instance_variable_set(:@payload_extenders, nil)
end
it 'calls that extender as well as the default one' do
@@ -82,7 +82,7 @@ RSpec.describe OpenProject::Logging, 'Log extenders' do
end
after do
- described_class.instance_variable_set('@payload_extenders', nil)
+ described_class.instance_variable_set(:@payload_extenders, nil)
end
it 'does not break the returned payload' do
diff --git a/spec/lib/open_project/notifications_spec.rb b/spec/lib/open_project/notifications_spec.rb
index 2ab7de10d29..295d4c0a8a4 100644
--- a/spec/lib/open_project/notifications_spec.rb
+++ b/spec/lib/open_project/notifications_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe OpenProject::Notifications do
end
it 'delivers a notification' do
- OpenProject::Notifications.send('notifications_spec_send', payload)
+ OpenProject::Notifications.send(:notifications_spec_send, payload)
end
end
diff --git a/spec/mailers/smtp_settings_spec.rb b/spec/mailers/smtp_settings_spec.rb
index fc5cb841a60..c4e0b69e30b 100644
--- a/spec/mailers/smtp_settings_spec.rb
+++ b/spec/mailers/smtp_settings_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe "SMTP settings" do
expect_any_instance_of(Net::SMTP).to receive(:start) do |instance|
expect(instance).to be_tls
- expect(instance.instance_variable_get('@ssl_context_tls').verify_mode).to eq OpenSSL::SSL::VERIFY_PEER
+ expect(instance.instance_variable_get(:@ssl_context_tls).verify_mode).to eq OpenSSL::SSL::VERIFY_PEER
end
end
@@ -136,7 +136,7 @@ RSpec.describe "SMTP settings" do
expect_any_instance_of(Net::SMTP).to receive(:start) do |instance|
expect(instance).to be_tls
- expect(instance.instance_variable_get('@ssl_context_tls').verify_mode).to eq OpenSSL::SSL::VERIFY_NONE
+ expect(instance.instance_variable_get(:@ssl_context_tls).verify_mode).to eq OpenSSL::SSL::VERIFY_NONE
end
end
@@ -157,7 +157,7 @@ RSpec.describe "SMTP settings" do
expect_any_instance_of(Net::SMTP).to receive(:start) do |instance|
expect(instance).to be_tls
expect(instance).not_to be_starttls_auto
- expect(instance.instance_variable_get('@ssl_context_tls').verify_mode).to eq OpenSSL::SSL::VERIFY_PEER
+ expect(instance.instance_variable_get(:@ssl_context_tls).verify_mode).to eq OpenSSL::SSL::VERIFY_PEER
end
end
diff --git a/spec/support/shared/with_direct_uploads.rb b/spec/support/shared/with_direct_uploads.rb
index 0b2bfbfb591..116b342bd01 100644
--- a/spec/support/shared/with_direct_uploads.rb
+++ b/spec/support/shared/with_direct_uploads.rb
@@ -63,7 +63,7 @@ class WithDirectUploads
def around(example)
example.metadata[:javascript_driver] = example.metadata[:driver] = :chrome_billy
- csp_config = SecureHeaders::Configuration.instance_variable_get("@default_config").csp
+ csp_config = SecureHeaders::Configuration.instance_variable_get(:@default_config).csp
connect_src = csp_config.connect_src.dup
form_action = csp_config.form_action.dup