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

bump rubocop and apply autofixes for new cops

ulferts4a94e03b045e
diff --git a/Gemfile.lock b/Gemfile.lock
index 2f08cc077f7..c2ecb061098 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -849,14 +849,14 @@ GEM
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-support (3.11.1)
- rubocop (1.36.0)
+ rubocop (1.37.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
- rubocop-ast (>= 1.20.1, < 2.0)
+ rubocop-ast (>= 1.22.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.22.0)
diff --git a/app/mailers/interceptors/default_headers.rb b/app/mailers/interceptors/default_headers.rb
index b387445d8c6..d087f704b12 100644
--- a/app/mailers/interceptors/default_headers.rb
+++ b/app/mailers/interceptors/default_headers.rb
@@ -1,10 +1,12 @@
module Interceptors
- class DefaultHeaders
- def self.delivering_email(mail)
+ module DefaultHeaders
+ module_function
+
+ def delivering_email(mail)
mail.headers(default_headers)
end
- def self.default_headers
+ def default_headers
{
'X-Mailer' => 'OpenProject',
'X-OpenProject-Host' => Setting.host_name,
diff --git a/app/mailers/interceptors/do_not_send_mails_without_recipient.rb b/app/mailers/interceptors/do_not_send_mails_without_recipient.rb
index a6d4192d772..1c3e684e043 100644
--- a/app/mailers/interceptors/do_not_send_mails_without_recipient.rb
+++ b/app/mailers/interceptors/do_not_send_mails_without_recipient.rb
@@ -1,6 +1,8 @@
module Interceptors
- class DoNotSendMailsWithoutRecipient
- def self.delivering_email(mail)
+ module DoNotSendMailsWithoutRecipient
+ module_function
+
+ def delivering_email(mail)
receivers = [mail.to, mail.cc, mail.bcc]
# the above fields might be empty arrays (if entries have been removed
# by another interceptor) or nil, therefore checking for blank?
diff --git a/app/models/custom_actions/actions/serializer.rb b/app/models/custom_actions/actions/serializer.rb
index e0b81496cc1..8184d7f5f8d 100644
--- a/app/models/custom_actions/actions/serializer.rb
+++ b/app/models/custom_actions/actions/serializer.rb
@@ -26,8 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class CustomActions::Actions::Serializer
- def self.load(value)
+module CustomActions::Actions::Serializer
+ module_function
+
+ def load(value)
return [] unless value
YAML
@@ -47,7 +49,7 @@ class CustomActions::Actions::Serializer
end.compact
end
- def self.dump(actions)
+ def dump(actions)
YAML::dump(actions.map { |a| [a.key, a.values.map(&:to_s)] })
end
end
diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb
index 3a700d90b61..5cf39deb507 100644
--- a/app/models/repository/subversion.rb
+++ b/app/models/repository/subversion.rb
@@ -87,7 +87,7 @@ class Repository::Subversion < Repository
# Returns a path relative to the url of the repository
def relative_path(path)
- path.gsub(Regexp.new("^\/?#{Regexp.escape(relative_url)}\/"), '')
+ path.gsub(Regexp.new("^/?#{Regexp.escape(relative_url)}/"), '')
end
def fetch_changesets
diff --git a/app/models/serializers/indifferent_hash_serializer.rb b/app/models/serializers/indifferent_hash_serializer.rb
index 7e826451f8c..0d606e72c6f 100644
--- a/app/models/serializers/indifferent_hash_serializer.rb
+++ b/app/models/serializers/indifferent_hash_serializer.rb
@@ -26,12 +26,14 @@
# See COPYRIGHT and LICENSE files for more details.
#++
module Serializers
- class IndifferentHashSerializer
- def self.dump(hash)
+ module IndifferentHashSerializer
+ module_function
+
+ def dump(hash)
hash
end
- def self.load(value)
+ def load(value)
hash = value.is_a?(Hash) ? value : {}
hash.with_indifferent_access
end
diff --git a/app/services/authorization.rb b/app/services/authorization.rb
index 9b82541efcc..4f7d6a7f6f9 100644
--- a/app/services/authorization.rb
+++ b/app/services/authorization.rb
@@ -26,19 +26,21 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Authorization
+module Authorization
+ module_function
+
# Returns all users having a certain permission within a project
- def self.users(action, project)
+ def users(action, project)
Authorization::UserAllowedQuery.query(action, project)
end
# Returns all projects a user has a certain permission in
- def self.projects(action, user)
+ def projects(action, user)
Authorization::ProjectQuery.query(user, action)
end
# Returns all roles a user has in a certain project or globally
- def self.roles(user, project = nil)
+ def roles(user, project = nil)
if project
Authorization::UserProjectRolesQuery.query(user, project)
else
diff --git a/app/services/work_packages/shared/days.rb b/app/services/work_packages/shared/days.rb
index b74c722aa43..0dc6180b877 100644
--- a/app/services/work_packages/shared/days.rb
+++ b/app/services/work_packages/shared/days.rb
@@ -28,9 +28,11 @@
module WorkPackages
module Shared
- class Days
+ module Days
+ module_function
+
# Returns the right day computation instance for the given instance.
- def self.for(work_package)
+ def for(work_package)
work_package.ignore_non_working_days ? AllDays.new : WorkingDays.new
end
end
diff --git a/db/migrate/migration_utils/permission_adder.rb b/db/migrate/migration_utils/permission_adder.rb
index 049a33eb60b..2ae208f9dfe 100644
--- a/db/migrate/migration_utils/permission_adder.rb
+++ b/db/migrate/migration_utils/permission_adder.rb
@@ -28,8 +28,10 @@
module Migration
module MigrationUtils
- class PermissionAdder
- def self.add(having, add)
+ module PermissionAdder
+ module_function
+
+ def add(having, add)
Role
.joins(:role_permissions)
.where(role_permissions: { permission: having.to_s })
diff --git a/db/migrate/tables/base.rb b/db/migrate/tables/base.rb
index 31b0a2318ed..03e8a699c7c 100644
--- a/db/migrate/tables/base.rb
+++ b/db/migrate/tables/base.rb
@@ -41,8 +41,8 @@ class Tables::Base
{ id: :integer }
end
- def self.create_table(migration, &block)
- migration.create_table table_name, **id_options.merge(bulk: true), &block
+ def self.create_table(migration, &)
+ migration.create_table table_name, **id_options.merge(bulk: true), &
end
def self.table(_migration)
diff --git a/lib/api/utilities/payload_representer.rb b/lib/api/utilities/payload_representer.rb
index c17cd1292cc..43e6bc68702 100644
--- a/lib/api/utilities/payload_representer.rb
+++ b/lib/api/utilities/payload_representer.rb
@@ -62,8 +62,10 @@ module API
end
end
- class UnwritablePropertyFilter
- def self.call(input, options)
+ module UnwritablePropertyFilter
+ module_function
+
+ def call(input, options)
writable_attr = options[:decorator].writable_attributes
as = options[:binding][:as].()
@@ -75,8 +77,10 @@ module API
end
end
- class LinkRenderBlock
- def self.call(input, options)
+ module LinkRenderBlock
+ module_function
+
+ def call(input, options)
writable_attr = options[:decorator].writable_attributes
input.reject do |link|
diff --git a/lib/api/utilities/query_filters_name_converter.rb b/lib/api/utilities/query_filters_name_converter.rb
index 63c0f3cc2da..050d1f9641a 100644
--- a/lib/api/utilities/query_filters_name_converter.rb
+++ b/lib/api/utilities/query_filters_name_converter.rb
@@ -31,15 +31,15 @@ require 'api/utilities/query_filters_name_converter_context'
module API
module Utilities
- class QueryFiltersNameConverter
- class << self
- def to_ar_name(attribute, refer_to_ids: false)
- conversion_wp = ::API::Utilities::QueryFiltersNameConverterContext.new
+ module QueryFiltersNameConverter
+ module_function
- ::API::Utilities::PropertyNameConverter.to_ar_name(attribute,
- context: conversion_wp,
- refer_to_ids:)
- end
+ def to_ar_name(attribute, refer_to_ids: false)
+ conversion_wp = ::API::Utilities::QueryFiltersNameConverterContext.new
+
+ ::API::Utilities::PropertyNameConverter.to_ar_name(attribute,
+ context: conversion_wp,
+ refer_to_ids:)
end
end
end
diff --git a/lib/api/utilities/resource_link_parser.rb b/lib/api/utilities/resource_link_parser.rb
index 70e91d36890..d80bc11515a 100644
--- a/lib/api/utilities/resource_link_parser.rb
+++ b/lib/api/utilities/resource_link_parser.rb
@@ -33,7 +33,7 @@ module API
# http://tools.ietf.org/html/rfc3986#section-3.3
SEGMENT_CHARACTER = '(\w|[-~!$&\'\(\)*+\.,:;=@]|%[0-9A-Fa-f]{2})'.freeze
RESOURCE_REGEX =
- "/api/v(?<version>\\d)/(?<namespace>[\\w\/]+)/(?<id>#{SEGMENT_CHARACTER}+)\\z".freeze
+ "/api/v(?<version>\\d)/(?<namespace>[\\w/]+)/(?<id>#{SEGMENT_CHARACTER}+)\\z".freeze
class << self
def parse(resource_link)
diff --git a/lib/api/utilities/wp_property_name_converter.rb b/lib/api/utilities/wp_property_name_converter.rb
index f9eb60b06f0..1fdbb8f1b4f 100644
--- a/lib/api/utilities/wp_property_name_converter.rb
+++ b/lib/api/utilities/wp_property_name_converter.rb
@@ -31,15 +31,15 @@ require 'api/utilities/property_name_converter_work_package_dummy'
module API
module Utilities
- class WpPropertyNameConverter
- class << self
- def to_ar_name(attribute, refer_to_ids: false)
- conversion_wp = ::API::Utilities::PropertyNameConverterWorkPackageDummy.new
+ module WpPropertyNameConverter
+ module_function
- ::API::Utilities::PropertyNameConverter.to_ar_name(attribute,
- context: conversion_wp,
- refer_to_ids:)
- end
+ def to_ar_name(attribute, refer_to_ids: false)
+ conversion_wp = ::API::Utilities::PropertyNameConverterWorkPackageDummy.new
+
+ ::API::Utilities::PropertyNameConverter.to_ar_name(attribute,
+ context: conversion_wp,
+ refer_to_ids:)
end
end
end
diff --git a/lib/api/v3/principals/principal_representer_factory.rb b/lib/api/v3/principals/principal_representer_factory.rb
index e920dcc6ce1..391fdf14c2a 100644
--- a/lib/api/v3/principals/principal_representer_factory.rb
+++ b/lib/api/v3/principals/principal_representer_factory.rb
@@ -29,16 +29,18 @@
module API
module V3
module Principals
- class PrincipalRepresenterFactory
+ module PrincipalRepresenterFactory
+ module_function
+
##
# Create the appropriate subclass representer
# for each principal entity
- def self.create(model, **args)
+ def create(model, **args)
representer_class(model)
.create(model, **args)
end
- def self.representer_class(model)
+ def representer_class(model)
case model
when User
::API::V3::Users::UserRepresenter
@@ -51,7 +53,7 @@ module API
end
end
- def self.create_link_lambda(name, getter: "#{name}_id")
+ def create_link_lambda(name, getter: "#{name}_id")
->(*) {
v3_path = API::V3::Principals::PrincipalType.for(represented.send(name))
@@ -63,7 +65,7 @@ module API
}
end
- def self.create_setter_lambda(name, property_name: name, namespaces: %i(groups users placeholder_users))
+ def create_setter_lambda(name, property_name: name, namespaces: %i(groups users placeholder_users))
->(fragment:, **) {
::API::Decorators::LinkObject
.new(represented,
@@ -75,7 +77,7 @@ module API
}
end
- def self.create_getter_lambda(name)
+ def create_getter_lambda(name)
->(*) {
next unless embed_links
diff --git a/lib/api/v3/principals/principal_type.rb b/lib/api/v3/principals/principal_type.rb
index fc115f4aa93..5a056aff1c3 100644
--- a/lib/api/v3/principals/principal_type.rb
+++ b/lib/api/v3/principals/principal_type.rb
@@ -29,11 +29,13 @@
module API
module V3
module Principals
- class PrincipalType
+ module PrincipalType
+ module_function
+
##
# Return the appropriate API level type
# that depend on the AR type of the principal passed in.
- def self.for(principal)
+ def for(principal)
case principal
when User
:user
diff --git a/lib/api/v3/utilities/date_time_formatter.rb b/lib/api/v3/utilities/date_time_formatter.rb
index b9442a180ac..5ce26971dea 100644
--- a/lib/api/v3/utilities/date_time_formatter.rb
+++ b/lib/api/v3/utilities/date_time_formatter.rb
@@ -29,14 +29,16 @@
module API
module V3
module Utilities
- class DateTimeFormatter
- def self.format_date(date, allow_nil: false)
+ module DateTimeFormatter
+ module_function
+
+ def format_date(date, allow_nil: false)
return nil if date.nil? && allow_nil
date.to_date.iso8601
end
- def self.parse_date(value, property_name, allow_nil: false)
+ def parse_date(value, property_name, allow_nil: false)
return nil if value.nil? && allow_nil
begin
@@ -60,7 +62,7 @@ module API
date_only
end
- def self.parse_datetime(value, property_name, allow_nil: false)
+ def parse_datetime(value, property_name, allow_nil: false)
return nil if value.nil? && allow_nil
begin
@@ -74,19 +76,19 @@ module API
date_and_time
end
- def self.format_datetime(datetime, allow_nil: false)
+ def format_datetime(datetime, allow_nil: false)
return nil if datetime.nil? && allow_nil
datetime.to_datetime.utc.iso8601
end
- def self.format_duration_from_hours(hours, allow_nil: false)
+ def format_duration_from_hours(hours, allow_nil: false)
return nil if hours.nil? && allow_nil
Duration.new(seconds: hours * 3600).iso8601
end
- def self.parse_duration_to_hours(duration, property_name, allow_nil: false)
+ def parse_duration_to_hours(duration, property_name, allow_nil: false)
return nil if duration.nil? && allow_nil
begin
@@ -99,7 +101,7 @@ module API
end
end
- def self.parse_duration_to_days(duration, property_name, allow_nil: false)
+ def parse_duration_to_days(duration, property_name, allow_nil: false)
return nil if duration.nil? && allow_nil
parse_duration_to_hours(duration, property_name).to_i / 24
diff --git a/lib/constraints/enterprise.rb b/lib/constraints/enterprise.rb
index 745348e3f7d..f9fd18c339d 100644
--- a/lib/constraints/enterprise.rb
+++ b/lib/constraints/enterprise.rb
@@ -26,8 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Enterprise
- def self.matches?(_request)
+module Enterprise
+ module_function
+
+ def matches?(_request)
OpenProject::Configuration.ee_manager_visible?
end
end
diff --git a/lib/instance_finder.rb b/lib/instance_finder.rb
index 50140e38c6b..266ad7fd15f 100644
--- a/lib/instance_finder.rb
+++ b/lib/instance_finder.rb
@@ -26,14 +26,16 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class InstanceFinder
- def self.register(model, method)
+module InstanceFinder
+ module_function
+
+ def register(model, method)
@model_method_map ||= {}
@model_method_map[model] = method
end
- def self.find(model, identifier)
+ def find(model, identifier)
if @model_method_map[model].nil?
raise "#{model} is not registered with InstanceFinder"
end
diff --git a/lib/open_project/custom_styles/color_themes.rb b/lib/open_project/custom_styles/color_themes.rb
index 8832d67f201..0ea9a142ec0 100644
--- a/lib/open_project/custom_styles/color_themes.rb
+++ b/lib/open_project/custom_styles/color_themes.rb
@@ -27,7 +27,9 @@
#++
module OpenProject::CustomStyles
- class ColorThemes
+ module ColorThemes
+ module_function
+
OpenProject::CustomStyles::ColorThemes::DEFAULT_THEME_NAME = 'OpenProject'.freeze
THEMES = [
@@ -97,7 +99,7 @@ module OpenProject::CustomStyles
}
].freeze
- def self.themes
+ def themes
THEMES
end
end
diff --git a/lib/open_project/custom_styles/design.rb b/lib/open_project/custom_styles/design.rb
index d721e0a5986..40a5b70d939 100644
--- a/lib/open_project/custom_styles/design.rb
+++ b/lib/open_project/custom_styles/design.rb
@@ -27,31 +27,33 @@
#++
module OpenProject::CustomStyles
- class Design
+ module Design
+ module_function
+
##
# Returns the name of the color scheme.
# To be overridden by a plugin
- def self.name
+ def name
'OpenProject Theme'
end
- def self.identifier
+ def identifier
:core_design
end
- def self.overridden?
+ def overridden?
identifier == :core_design
end
##
# Path the favicon
- def self.favicon_asset_path
+ def favicon_asset_path
'favicon.ico'.freeze
end
##
# Returns the keys of variables that are customizable through the design
- def self.customizable_variables
+ def customizable_variables
%w( primary-color
primary-color-dark
alternative-color
diff --git a/lib/open_project/logging/thread_pool_context_builder.rb b/lib/open_project/logging/thread_pool_context_builder.rb
index b196b2ae677..0c9465f4845 100644
--- a/lib/open_project/logging/thread_pool_context_builder.rb
+++ b/lib/open_project/logging/thread_pool_context_builder.rb
@@ -1,10 +1,12 @@
module OpenProject
module Logging
- class ThreadPoolContextBuilder
+ module ThreadPoolContextBuilder
+ module_function
+
##
# Build an object informing about current Rails connection pool
# and active thread usage and their traces
- def self.build!
+ def build!
thread_info = {}
Thread.list.each_with_index do |t, i|
thread_info[i] = {
diff --git a/lib/open_project/plugins/module_handler.rb b/lib/open_project/plugins/module_handler.rb
index 86d0074af2d..6c05f75f33a 100644
--- a/lib/open_project/plugins/module_handler.rb
+++ b/lib/open_project/plugins/module_handler.rb
@@ -27,14 +27,14 @@
#++project_module
module OpenProject::Plugins
- class ModuleHandler
+ module ModuleHandler
+ module_function
+
@@disabled_modules = []
- class << self
- def disable_modules!(module_names)
- @@disabled_modules += Array(module_names).map(&:to_sym).each do |module_name|
- OpenProject::AccessControl.remove_modules_permissions(module_name)
- end
+ def disable_modules!(module_names)
+ @@disabled_modules += Array(module_names).map(&:to_sym).each do |module_name|
+ OpenProject::AccessControl.remove_modules_permissions(module_name)
end
end
end
diff --git a/lib/open_project/text_formatting/renderer.rb b/lib/open_project/text_formatting/renderer.rb
index 626f0ee5d6b..0602a535e2d 100644
--- a/lib/open_project/text_formatting/renderer.rb
+++ b/lib/open_project/text_formatting/renderer.rb
@@ -27,22 +27,22 @@
#++
module OpenProject::TextFormatting
- class Renderer
- class << self
- def format_text(text, options = {})
- return '' if text.blank?
+ module Renderer
+ module_function
- formatter(plain: options.delete(:plain))
- .new(options)
- .to_html(text)
- end
+ def format_text(text, options = {})
+ return '' if text.blank?
+
+ formatter(plain: options.delete(:plain))
+ .new(options)
+ .to_html(text)
+ end
- def formatter(plain: false)
- if plain
- OpenProject::TextFormatting::Formats.plain_formatter
- else
- OpenProject::TextFormatting::Formats.rich_formatter
- end
+ def formatter(plain: false)
+ if plain
+ OpenProject::TextFormatting::Formats.plain_formatter
+ else
+ OpenProject::TextFormatting::Formats.rich_formatter
end
end
end
diff --git a/lib/redmine/about.rb b/lib/redmine/about.rb
index 32820c7e285..60270ac5329 100644
--- a/lib/redmine/about.rb
+++ b/lib/redmine/about.rb
@@ -27,8 +27,10 @@
#++
module Redmine
- class About
- def self.print_plugin_info
+ module About
+ module_function
+
+ def print_plugin_info
plugins = Redmine::Plugin.registered_plugins
if !plugins.empty?
diff --git a/lib/tasks/parallel_testing.rake b/lib/tasks/parallel_testing.rake
index 279eb511f16..3d9cf3f1a5b 100644
--- a/lib/tasks/parallel_testing.rake
+++ b/lib/tasks/parallel_testing.rake
@@ -45,8 +45,10 @@ def check_for_pending_migrations
end
namespace :parallel do
- class ParallelParser
- def self.with_args(args, allow_seed = true)
+ module ParallelParser
+ module_function
+
+ def with_args(args, allow_seed = true)
options = {}
parseable_args = args[2..-1]
if parseable_args
@@ -128,7 +130,7 @@ namespace :parallel do
desc 'Run plugin unit specs in parallel'
task units: [:environment] do
- pattern = "--pattern 'spec/(?!features\/)'"
+ pattern = "--pattern 'spec/(?!features/)'"
ParallelParser.with_args(ARGV) do |options|
ARGV.each { |a| task(a.to_sym) {} }
@@ -139,7 +141,7 @@ namespace :parallel do
desc 'Run plugin feature specs in parallel'
task features: [:environment] do
- pattern = "--pattern 'spec\/features'"
+ pattern = "--pattern 'spec/features'"
ParallelParser.with_args(ARGV) do |options|
ARGV.each { |a| task(a.to_sym) {} }
@@ -160,7 +162,7 @@ namespace :parallel do
desc 'Run feature specs in parallel'
task features: [:environment] do
- pattern = "--pattern 'spec\/features\/'"
+ pattern = "--pattern 'spec/features/'"
ParallelParser.with_args(ARGV) do |options|
ARGV.each { |a| task(a.to_sym) {} }
@@ -171,7 +173,7 @@ namespace :parallel do
desc 'Run unit specs in parallel'
task units: [:environment] do
- pattern = "--pattern 'spec/(?!features\/)'"
+ pattern = "--pattern 'spec/(?!features/)'"
ParallelParser.with_args(ARGV) do |options|
ARGV.each { |a| task(a.to_sym) {} }
diff --git a/modules/auth_saml/lib/open_project/auth_saml/inspector.rb b/modules/auth_saml/lib/open_project/auth_saml/inspector.rb
index 2f76b321997..3f745dce999 100644
--- a/modules/auth_saml/lib/open_project/auth_saml/inspector.rb
+++ b/modules/auth_saml/lib/open_project/auth_saml/inspector.rb
@@ -1,7 +1,9 @@
module OpenProject
module AuthSaml
- class Inspector
- def self.inspect_response(auth_hash)
+ module Inspector
+ module_function
+
+ def inspect_response(auth_hash)
response = auth_hash.dig(:extra, :response_object)
if response
code = response.status_code ? "(CODE #{response.status_code})" : nil
diff --git a/modules/bim/lib/api/bim/utilities/path_helper.rb b/modules/bim/lib/api/bim/utilities/path_helper.rb
index 07f6df78028..978260d651a 100644
--- a/modules/bim/lib/api/bim/utilities/path_helper.rb
+++ b/modules/bim/lib/api/bim/utilities/path_helper.rb
@@ -33,34 +33,36 @@ module API
include API::Utilities::UrlHelper
# rubocop:disable Naming/ClassAndModuleCamelCase
- class BCF2_1Path
+ module BCF2_1Path
+ module_function
+
# rubocop:enable Naming/ClassAndModuleCamelCase
extend API::Utilities::UrlHelper
# Determining the root_path on every url we want to render is
# expensive. As the root_path will not change within a
# request, we can cache the first response on each request.
- def self.root_path
+ def root_path
RequestStore.store[:cached_root_path] ||= super
end
- def self.root
+ def root
"#{root_path}api/bcf/2.1/"
end
- def self.project(identifier)
+ def project(identifier)
"#{root}projects/#{identifier}"
end
- def self.topics(project_identifier)
+ def topics(project_identifier)
"#{project(project_identifier)}/topics"
end
- def self.topic(project_identifier, uuid)
+ def topic(project_identifier, uuid)
"#{topics(project_identifier)}/#{uuid}"
end
- def self.viewpoint(project_identifier, topic_uuid, viewpoint_topic)
+ def viewpoint(project_identifier, topic_uuid, viewpoint_topic)
"#{topic(project_identifier, topic_uuid)}/viewpoints/#{viewpoint_topic}"
end
end
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index e4ac3055f65..f59d1c54aa2 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -41,7 +41,7 @@ describe ApplicationController, type: :controller do
describe 'logging requesting users' do
let(:user_message) do
- "OpenProject User: #{user.firstname} Crazy! Name with \#\# " +
+ "OpenProject User: #{user.firstname} Crazy! Name with ## " +
"Newline (#{user.login} ID: #{user.id} <#{user.mail}>)"
end
diff --git a/spec/features/notifications/reminder_mail_spec.rb b/spec/features/notifications/reminder_mail_spec.rb
index b58757d0a8a..a7836c2eb8f 100644
--- a/spec/features/notifications/reminder_mail_spec.rb
+++ b/spec/features/notifications/reminder_mail_spec.rb
@@ -67,10 +67,10 @@ describe "Reminder email sending", type: :feature, js: true do
# Perform some actions the user listens to
User.execute_as other_user do
note = <<~NOTE
- Hey <mention class=\"mention\"
- data-id=\"#{current_user.id}\"
- data-type=\"user\"
- data-text=\"@#{current_user.name}\">
+ Hey <mention class="mention"
+ data-id="#{current_user.id}"
+ data-type="user"
+ data-text="@#{current_user.name}">
@#{current_user.name}
</mention>
NOTE
diff --git a/spec/features/notifications/settings/immediate_reminder_spec.rb b/spec/features/notifications/settings/immediate_reminder_spec.rb
index 157a9fd1c8e..a5efca45b59 100644
--- a/spec/features/notifications/settings/immediate_reminder_spec.rb
+++ b/spec/features/notifications/settings/immediate_reminder_spec.rb
@@ -78,10 +78,10 @@ describe "Immediate reminder settings", type: :feature, js: true do
it 'sends a mail to the mentioned user immediately' do
perform_enqueued_jobs do
note = <<~NOTE
- Hey <mention class=\"mention\"
- data-id=\"#{receiver.id}\"
- data-type=\"user\"
- data-text=\"@#{receiver.name}\">
+ Hey <mention class="mention"
+ data-id="#{receiver.id}"
+ data-type="user"
+ data-text="@#{receiver.name}">
@#{receiver.name}
</mention>
NOTE
diff --git a/spec/features/wiki/wiki_unicode_spec.rb b/spec/features/wiki/wiki_unicode_spec.rb
index 417132d2fee..cf83819d852 100644
--- a/spec/features/wiki/wiki_unicode_spec.rb
+++ b/spec/features/wiki/wiki_unicode_spec.rb
@@ -102,7 +102,7 @@ describe 'Wiki unicode title spec', type: :feature, js: true do
target_link = all('div.wiki-content a.wiki-page')[i]
expect(target_link.text).to eq(title)
- expect(target_link[:href]).to match("\/wiki\/#{expected_slugs[i]}")
+ expect(target_link[:href]).to match("/wiki/#{expected_slugs[i]}")
target_link.click
expect(page).to have_selector('.title-container h2', text: title)
diff --git a/spec/lib/api/v3/work_packages/eager_loading/eager_loading_mock_wrapper.rb b/spec/lib/api/v3/work_packages/eager_loading/eager_loading_mock_wrapper.rb
index 876f03e21a5..4773c149328 100644
--- a/spec/lib/api/v3/work_packages/eager_loading/eager_loading_mock_wrapper.rb
+++ b/spec/lib/api/v3/work_packages/eager_loading/eager_loading_mock_wrapper.rb
@@ -26,8 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class EagerLoadingMockWrapper
- def self.wrap(klass, work_packages)
+module EagerLoadingMockWrapper
+ module_function
+
+ def wrap(klass, work_packages)
klass_module = klass.module
delegator_class = Class.new(SimpleDelegator) do
diff --git a/spec/lib/custom_field_form_builder_spec.rb b/spec/lib/custom_field_form_builder_spec.rb
index 41dafeb7661..494b6625465 100644
--- a/spec/lib/custom_field_form_builder_spec.rb
+++ b/spec/lib/custom_field_form_builder_spec.rb
@@ -205,8 +205,8 @@ describe CustomFieldFormBuilder do
id="user#{custom_field.id}"
name="user[#{custom_field.id}]"
no_label="true"><option
- value=\"\" label=\" \"></option>
- <option value=\"#{custom_option.id}\">my_option</option></select>
+ value="" label=" "></option>
+ <option value="#{custom_option.id}">my_option</option></select>
}).at_path('select')
end
@@ -220,9 +220,9 @@ describe CustomFieldFormBuilder do
<select class="custom-class form--select"
id="user#{custom_field.id}"
name="user[#{custom_field.id}]"
- no_label="true"><option value=\"\">---
+ no_label="true"><option value="">---
Please select ---</option>
- <option value=\"#{custom_option.id}\">my_option</option></select>
+ <option value="#{custom_option.id}">my_option</option></select>
}).at_path('select')
end
end
@@ -239,7 +239,7 @@ describe CustomFieldFormBuilder do
id="user#{custom_field.id}"
name="user[#{custom_field.id}]"
no_label="true"><option
- value=\"#{custom_option.id}\">my_option</option></select>
+ value="#{custom_option.id}">my_option</option></select>
}).at_path('select')
end
end
@@ -274,7 +274,7 @@ describe CustomFieldFormBuilder do
id="user#{custom_field.id}"
name="user[#{custom_field.id}]"
no_label="true">
- <option value=\"\" label=\" \"></option>
+ <option value="" label=" "></option>
<option value="#{user1.id}">#{user1.name}</option>
<option value="#{user2.id}">#{user2.name}</option>
</select>
@@ -292,7 +292,7 @@ describe CustomFieldFormBuilder do
id="user#{custom_field.id}"
name="user[#{custom_field.id}]"
no_label="true">
- <option value=\"\">--- Please select ---</option>
+ <option value="">--- Please select ---</option>
<option value="#{user1.id}">#{user1.name}</option>
<option value="#{user2.id}">#{user2.name}</option>
</select>
@@ -329,7 +329,7 @@ describe CustomFieldFormBuilder do
id="user#{custom_field.id}"
name="user[#{custom_field.id}]"
no_label="true">
- <option value=\"\" label=\" \"></option>
+ <option value="" label=" "></option>
<option value="#{version1.id}">#{version1.name}</option>
<option value="#{version2.id}">#{version2.name}</option>
</select>
@@ -347,7 +347,7 @@ describe CustomFieldFormBuilder do
id="user#{custom_field.id}"
name="user[#{custom_field.id}]"
no_label="true">
- <option value=\"\">--- Please select ---</option>
+ <option value="">--- Please select ---</option>
<option value="#{version1.id}">#{version1.name}</option>
<option value="#{version2.id}">#{version2.name}</option>
</select>
diff --git a/spec/lib/open_project/text_formatting/markdown/embedded_table_macro_spec.rb b/spec/lib/open_project/text_formatting/markdown/embedded_table_macro_spec.rb
index c6d1eac7d41..687e5226098 100644
--- a/spec/lib/open_project/text_formatting/markdown/embedded_table_macro_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/embedded_table_macro_spec.rb
@@ -37,7 +37,7 @@ describe OpenProject::TextFormatting,
let(:raw) do
<<~RAW
<macro class="embedded-table op-uc-placeholder"
- data-query-props="{&quot;columns[]&quot;:[&quot;id&quot;,&quot;subject&quot;,&quot;type&quot;,&quot;status&quot;,&quot;assignee&quot;,&quot;updatedAt&quot;],&quot;showSums&quot;:false,&quot;timelineVisible&quot;:false,&quot;highlightingMode&quot;:&quot;inline&quot;,&quot;highlightedAttributes[]&quot;:[&quot;/api/v3/queries/columns/status&quot;,&quot;/api/v3/queries/columns/priority&quot;,&quot;/api/v3/queries/columns/dueDate&quot;],&quot;showHierarchies&quot;:true,&quot;groupBy&quot;:&quot;&quot;,&quot;filters&quot;:&quot;[{\&quot;status\&quot;:{\&quot;operator\&quot;:\&quot;o\&quot;,\&quot;values\&quot;:[]}}]&quot;,&quot;sortBy&quot;:&quot;[[\&quot;id\&quot;,\&quot;asc\&quot;]]&quot;}">
+ data-query-props="{&quot;columns[]&quot;:[&quot;id&quot;,&quot;subject&quot;,&quot;type&quot;,&quot;status&quot;,&quot;assignee&quot;,&quot;updatedAt&quot;],&quot;showSums&quot;:false,&quot;timelineVisible&quot;:false,&quot;highlightingMode&quot;:&quot;inline&quot;,&quot;highlightedAttributes[]&quot;:[&quot;/api/v3/queries/columns/status&quot;,&quot;/api/v3/queries/columns/priority&quot;,&quot;/api/v3/queries/columns/dueDate&quot;],&quot;showHierarchies&quot;:true,&quot;groupBy&quot;:&quot;&quot;,&quot;filters&quot;:&quot;[{&quot;status&quot;:{&quot;operator&quot;:&quot;o&quot;,&quot;values&quot;:[]}}]&quot;,&quot;sortBy&quot;:&quot;[[&quot;id&quot;,&quot;asc&quot;]]&quot;}">
</macro>
RAW
end
diff --git a/spec/lib/redmine/unified_diff_spec.rb b/spec/lib/redmine/unified_diff_spec.rb
index bc365a3e379..9ad236ce5e2 100644
--- a/spec/lib/redmine/unified_diff_spec.rb
+++ b/spec/lib/redmine/unified_diff_spec.rb
@@ -145,7 +145,7 @@ describe Redmine::UnifiedDiff do
+ @truncated = false
diff_table = DiffTable.new(diff_type)
diff.each do |line|
- if line =~ /^(---|\+\+\+) (.*)$/
+ if line =~ /^(---|+++) (.*)$/
@@ -28,10 +31,17 @@
diff_table = DiffTable.new(diff_type)
end
diff --git a/spec/support/parallel_helper.rb b/spec/support/parallel_helper.rb
index 4a54f69b9a6..72070d68076 100644
--- a/spec/support/parallel_helper.rb
+++ b/spec/support/parallel_helper.rb
@@ -1,9 +1,11 @@
-class ParallelHelper
- def self.port_for_ldap
+module ParallelHelper
+ module_function
+
+ def port_for_ldap
ENV.fetch('TEST_ENV_NUMBER', '1').to_i + 12389
end
- def self.port_for_app
+ def port_for_app
ENV.fetch('TEST_ENV_NUMBER', '1').to_i + 3000
end
end
diff --git a/spec/support/selenium_hub_waiter.rb b/spec/support/selenium_hub_waiter.rb
index 6f2ea12bd89..1c819cd5b6b 100644
--- a/spec/support/selenium_hub_waiter.rb
+++ b/spec/support/selenium_hub_waiter.rb
@@ -1,7 +1,9 @@
-class SeleniumHubWaiter
+module SeleniumHubWaiter
+ module_function
+
# frontend not fast enough to bind click handlers on buttons?
# only happens when using the Selenium Hub
- def self.wait
+ def wait
sleep 1 if ENV.fetch("SELENIUM_GRID_URL", "").present?
end
end