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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fixes Performance/StringInclude offenses
Klaus Zanders87906bd208c4
diff --git a/db/migrate/20230328154645_add_gin_trgm_index_on_journals_and_custom_values.rb b/db/migrate/20230328154645_add_gin_trgm_index_on_journals_and_custom_values.rbindex 7b15c190587..dbbfaccecee 100644--- a/db/migrate/20230328154645_add_gin_trgm_index_on_journals_and_custom_values.rb+++ b/db/migrate/20230328154645_add_gin_trgm_index_on_journals_and_custom_values.rb@@ -47,7 +47,7 @@ class AddGinTrgmIndexOnJournalsAndCustomValues < ActiveRecord::Migration[7.0]def safe_enable_pg_trgm_extensionActiveRecord::Base.connection.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA pg_catalog;")rescue StandardError => e- raise unless /pg_trgm/.match?(e.message)+ raise unless e.message.include?('pg_trgm')# Rollback the transaction in order to recover from the error.ActiveRecord::Base.connection.execute 'ROLLBACK'diff --git a/lib/tasks/yardoc.rake b/lib/tasks/yardoc.rakeindex 975289478c4..50c0aea8ab6 100644--- a/lib/tasks/yardoc.rake+++ b/lib/tasks/yardoc.rake@@ -31,7 +31,7 @@ beginYARD::Rake::YardocTask.new do |t|files = ['lib/**/*.rb', 'app/**/*.rb']- files << Dir['vendor/plugins/**/*.rb'].reject { |f| f.match(/test/) } # Exclude test files+ files << Dir['vendor/plugins/**/*.rb'].reject { |f| f.include?('test') } # Exclude test filest.files = filesstatic_files = ['doc/CHANGELOG.rdoc',diff --git a/lib_static/open_project/configuration/helpers.rb b/lib_static/open_project/configuration/helpers.rbindex 98e44561058..d00cf18e5fe 100644--- a/lib_static/open_project/configuration/helpers.rb+++ b/lib_static/open_project/configuration/helpers.rb@@ -201,7 +201,7 @@ module OpenProject# Either the value already is an array or a string with values separated by spaces.# In the latter case the string will be split and the values returned as an array.def array(value)- if value.is_a?(String) && value =~ / /+ if value.is_a?(String) && value.include?(' ')value.splitelseArray(value)diff --git a/modules/backlogs/lib/open_project/backlogs/hooks/layout_hook.rb b/modules/backlogs/lib/open_project/backlogs/hooks/layout_hook.rbindex b77567b56a7..151e1a90ed2 100644--- a/modules/backlogs/lib/open_project/backlogs/hooks/layout_hook.rb+++ b/modules/backlogs/lib/open_project/backlogs/hooks/layout_hook.rb@@ -86,7 +86,7 @@ module OpenProject::Backlogs::Hooksendif params[:copy_tasks]- params[:copy_tasks] += ':' if !/:/.match?(params[:copy_tasks])+ params[:copy_tasks] += ':' if !params[:copy_tasks].include?(':')action, id = *params[:copy_tasks].split(/:/)story = (id.nil? ? nil : Story.find(Integer(id)))diff --git a/modules/costs/app/controllers/costlog_controller.rb b/modules/costs/app/controllers/costlog_controller.rbindex b7c42c0a274..ae1f23a605b 100644--- a/modules/costs/app/controllers/costlog_controller.rb+++ b/modules/costs/app/controllers/costlog_controller.rb@@ -86,7 +86,7 @@ class CostlogController < ApplicationController@cost_entry.destroyflash[:notice] = t(:notice_successful_delete)- if /cost_reports/.match?(request.referer)+ if request.referer.include?('cost_reports')redirect_to controller: '/cost_reports', action: :indexelseredirect_back fallback_location: work_package_path(@cost_entry.work_package)diff --git a/modules/github_integration/spec/support/pages/work_package_github_tab.rb b/modules/github_integration/spec/support/pages/work_package_github_tab.rbindex 75ab7f18947..7c677dabb3a 100644--- a/modules/github_integration/spec/support/pages/work_package_github_tab.rb+++ b/modules/github_integration/spec/support/pages/work_package_github_tab.rb@@ -62,7 +62,7 @@ module Pagesprivatedef osx?- RbConfig::CONFIG['host_os'] =~ /darwin/+ RbConfig::CONFIG['host_os'].include?('darwin')endendenddiff --git a/modules/reporting/spec/models/cost_query/operator_spec.rb b/modules/reporting/spec/models/cost_query/operator_spec.rbindex 90bb09587cc..cb7b980eec2 100644--- a/modules/reporting/spec/models/cost_query/operator_spec.rb+++ b/modules/reporting/spec/models/cost_query/operator_spec.rb@@ -100,15 +100,15 @@ RSpec.describe CostQuery, reporting_query_helper: true doendit "does ~ (contains)" do- expect(cost_query('projects', 'name', '~', 'o').size).to eq(Project.all.count { |p| p.name =~ /o/ })- expect(cost_query('projects', 'name', '~', 'test').size).to eq(Project.all.count { |p| p.name =~ /test/ })- expect(cost_query('projects', 'name', '~', 'child').size).to eq(Project.all.count { |p| p.name =~ /child/ })+ expect(cost_query('projects', 'name', '~', 'o').size).to eq(Project.all.count { |p| p.name.include?('o') })+ expect(cost_query('projects', 'name', '~', 'test').size).to eq(Project.all.count { |p| p.name.include?('test') })+ expect(cost_query('projects', 'name', '~', 'child').size).to eq(Project.all.count { |p| p.name.include?('child') })endit "does !~ (not contains)" do- expect(cost_query('projects', 'name', '!~', 'o').size).to eq(Project.all.count { |p| !(p.name =~ /o/) })- expect(cost_query('projects', 'name', '!~', 'test').size).to eq(Project.all.count { |p| !(p.name =~ /test/) })- expect(cost_query('projects', 'name', '!~', 'child').size).to eq(Project.all.count { |p| !(p.name =~ /child/) })+ expect(cost_query('projects', 'name', '!~', 'o').size).to eq(Project.all.count { |p| !(p.name.include?('o')) })+ expect(cost_query('projects', 'name', '!~', 'test').size).to eq(Project.all.count { |p| !(p.name.include?('test')) })+ expect(cost_query('projects', 'name', '!~', 'child').size).to eq(Project.all.count { |p| !(p.name.include?('child')) })endit "does c (closed work_package)" dodiff --git a/spec/support/shared/with_direct_uploads.rb b/spec/support/shared/with_direct_uploads.rbindex 333aa72455f..65c3476d52c 100644--- a/spec/support/shared/with_direct_uploads.rb+++ b/spec/support/shared/with_direct_uploads.rb@@ -117,7 +117,7 @@ class WithDirectUploads.and_return(Proc.new do |_params, _headers, body, _url, _method|key = body.scan(/key"\s*([^\s]+)\s/m).flatten.firstredirect_url = body.scan(/success_action_redirect"\s*(http[^\s]+)\s/m).flatten.first- ok = body =~ /X-Amz-Signature/ # check that the expected post to AWS was made with the form fields+ ok = body.include?('X-Amz-Signature') # check that the expected post to AWS was made with the form fields{code: ok ? 302 : 403,@@ -135,7 +135,7 @@ class WithDirectUploads.stub("https://" + OpenProject::Configuration.remote_storage_upload_host + ":443/", method: 'post').and_return(Proc.new do |_params, _headers, body, _url, _method|{- code: /X-Amz-Signature/.match?(body) ? 201 : 403, # check that the expected post to AWS was made with the form fields+ code: body.include?('X-Amz-Signature') ? 201 : 403, # check that the expected post to AWS was made with the form fieldsheaders: {'Access-Control-Allow-Methods' => 'POST','Access-Control-Allow-Origin' => '*'