Introduce SubclassResponsibility error

This error is intended for cases when a method is
intentionally not implemented, because the module/class defining
it expects a subclass (or class including the module) to implement
the method.

This is intended to distinguish it from other cases, such as:
* feature not implemented yet
* edge case of a method call not yet supported

Notably it avoids the misuse of the Ruby-defined NotImplementedError,
which is only intended for much more specific scenarios:

> Raised when a feature is not implemented on the current platform. For example, methods depending on the fsync or fork system calls may raise this exception [...]

Also see https://docs.ruby-lang.org/en/master/NotImplementedError.html
This commit is contained in:
Jan Sandbrink
2026-03-26 13:28:12 +01:00
parent c65ed4154c
commit f9d8bc6614
121 changed files with 239 additions and 207 deletions
@@ -75,7 +75,7 @@ class IndividualPrincipalBaseFilterComponent < ApplicationComponent
end
def base_query
raise NotImplementedError
raise SubclassResponsibilityError
end
protected
@@ -93,7 +93,7 @@ class IndividualPrincipalBaseFilterComponent < ApplicationComponent
# INSTANCE METHODS:
def filter_path
raise NotImplementedError
raise SubclassResponsibilityError
end
def initially_visible?
@@ -38,7 +38,7 @@ module OpPrimer
super()
if !show_button && alt_text.blank?
raise NotImplementedError, "alt_text must be provided when the button is shown conditionally"
raise ArgumentError, "alt_text must be provided when the button is shown conditionally"
end
@@ -50,7 +50,7 @@ module OpPrimer
end
def default_button_title
raise NotImplementedError
raise SubclassResponsibilityError
end
def disabled?
@@ -40,7 +40,7 @@ module WorkPackages
end
def format
raise NotImplementedError, "Must be overridden in subclass"
raise SubclassResponsibilityError
end
def export_settings
+1 -1
View File
@@ -122,7 +122,7 @@ module Projects
end
def manage_permission
raise NotImplementedError
raise SubclassResponsibilityError
end
def with_unchanged_id
+2 -2
View File
@@ -48,7 +48,7 @@ module Shares
end
def user_allowed_to_manage?
raise NotImplementedError, "Must be overridden by subclass"
raise SubclassResponsibilityError
end
def single_non_inherited_role
@@ -76,7 +76,7 @@ module Shares
end
def assignable_role_class
raise NotImplementedError, "Must be overridden by subclass"
raise SubclassResponsibilityError
end
end
end
@@ -227,7 +227,7 @@ module Admin
end
def find_custom_field
raise NotImplementedError, "SubclassResponsibility"
raise SubclassResponsibilityError
end
def find_active_item
@@ -136,7 +136,7 @@ module Admin
end
def enumeration_class
raise NotImplementedError
raise SubclassResponsibilityError
end
def enumeration_permitted_params
@@ -51,11 +51,11 @@ module CustomFields
end
def show_path
raise NotImplementedError, "#{self.class} must implement #show_path"
raise SubclassResponsibilityError, "#{self.class} must implement #show_path"
end
def render_attribute_help_text_form(status: :ok)
raise NotImplementedError, "#{self.class} must implement #render_attribute_help_text_form"
raise SubclassResponsibilityError, "#{self.class} must implement #render_attribute_help_text_form"
end
def find_or_initialize_attribute_help_text
@@ -69,7 +69,7 @@ module CustomFields::CustomFieldRendering
end
def custom_fields
raise NotImplementedError, "#custom_fields method needs to be overwritten and provide all custom fields we want to show"
raise SubclassResponsibilityError, "#custom_fields needs to be overwritten and provide all custom fields we want to show"
end
private
@@ -49,7 +49,7 @@ class CustomFields::Inputs::Base::Autocomplete::MultiValueInput < CustomFields::
end
def decorated?
raise NotImplementedError
raise SubclassResponsibilityError
end
def custom_values
@@ -49,6 +49,6 @@ class CustomFields::Inputs::Base::Autocomplete::SingleValueInput < CustomFields:
end
def decorated?
raise NotImplementedError
raise SubclassResponsibilityError
end
end
+2 -2
View File
@@ -72,7 +72,7 @@ class Submenu
end
def default_queries
raise NotImplementedError
raise SubclassResponsibilityError
end
def global_queries
@@ -150,7 +150,7 @@ class Submenu
end
def query_path(query_params)
raise NotImplementedError
raise SubclassResponsibilityError
end
def url_helpers
+2 -2
View File
@@ -77,11 +77,11 @@ module Activities
end
def event_data(journal)
raise NotImplementedError
raise SubclassResponsibilityError
end
def event_title(journal, data)
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
+3 -3
View File
@@ -80,15 +80,15 @@ class AttributeHelpText < ApplicationRecord
end
def type_caption
raise NotImplementedError
raise SubclassResponsibilityError
end
def self.visible_condition(_user = nil)
raise NotImplementedError
raise SubclassResponsibilityError
end
def self.available_attributes
raise NotImplementedError
raise SubclassResponsibilityError
end
end
+1 -1
View File
@@ -49,7 +49,7 @@ class AuthProvider < ApplicationRecord
end
def human_type
raise NotImplementedError
raise SubclassResponsibilityError
end
def auth_url
+4 -4
View File
@@ -42,7 +42,7 @@ class CustomActions::Actions::Base
end
def allowed_values
raise NotImplementedError
raise SubclassResponsibilityError
end
def value_objects
@@ -52,11 +52,11 @@ class CustomActions::Actions::Base
end
def type
raise NotImplementedError
raise SubclassResponsibilityError
end
def apply(_work_package)
raise NotImplementedError
raise SubclassResponsibilityError
end
def human_name
@@ -64,7 +64,7 @@ class CustomActions::Actions::Base
end
def self.key
raise NotImplementedError
raise SubclassResponsibilityError
end
def self.all
@@ -35,7 +35,7 @@ class CustomActions::Actions::CustomField < CustomActions::Actions::Base
end
def custom_field
raise NotImplementedError
raise SubclassResponsibilityError
end
def all
+1 -1
View File
@@ -67,7 +67,7 @@ class CustomActions::Conditions::Base
end
def self.key
raise NotImplementedError
raise SubclassResponsibilityError
end
def validate(errors)
@@ -69,7 +69,7 @@ class CustomValue::ARObjectStrategy < CustomValue::FormatStrategy
end
def ar_class
raise NotImplementedError
raise SubclassResponsibilityError
end
def ar_object(value)
+2 -2
View File
@@ -42,7 +42,7 @@ class CustomValue::FormatStrategy
# Returns the value of the CustomValue in a typed fashion (i.e. not as the string
# that is used for representation in the database)
def typed_value
raise "SubclassResponsibility"
raise SubclassResponsibilityError
end
# Returns the value of the CustomValue formatted to a string
@@ -59,6 +59,6 @@ class CustomValue::FormatStrategy
# Validates the type of the custom field and returns a symbol indicating the validation error
# if an error occurred; returns nil if no error occurred
def validate_type_of_value
raise "SubclassResponsibility"
raise SubclassResponsibilityError
end
end
+1 -1
View File
@@ -63,7 +63,7 @@ module Exports
# Run the export, yielding the result of the render output
def export!
raise NotImplementedError
raise SubclassResponsibilityError
end
protected
+1 -1
View File
@@ -137,7 +137,7 @@ class Principal < ApplicationRecord
# Columns required for formatting the principal's name.
def self.columns_for_name(formatter = nil)
raise NotImplementedError, "Redefine in subclass" unless self == Principal
raise SubclassResponsibilityError, "Redefine in subclass" unless self == Principal
[User, Group, PlaceholderUser].map { it.columns_for_name(formatter) }.inject(:|)
end
+2 -2
View File
@@ -79,11 +79,11 @@ class Queries::Filters::Base
end
def human_name
raise NotImplementedError
raise SubclassResponsibilityError
end
def type
raise NotImplementedError
raise SubclassResponsibilityError
end
def allowed_values
@@ -50,11 +50,11 @@ module Queries::Filters::Shared::ParsedFilter
private
def split_values
raise NotImplementedError
raise SubclassResponsibilityError
end
def value_conditions
raise NotImplementedError
raise SubclassResponsibilityError
end
def validate_values
@@ -42,11 +42,11 @@ module Queries::Filters::Strategies
private
def numeric_class
raise NotImplementedError
raise SubclassResponsibilityError
end
def error_message
raise NotImplementedError
raise SubclassResponsibilityError
end
def validate_values_all_numeric
+1 -1
View File
@@ -45,7 +45,7 @@ module Queries
end
def self.key
raise NotImplementedError
raise SubclassResponsibilityError
end
def association_class
+1 -1
View File
@@ -53,7 +53,7 @@ module Queries::Operators
end
def self.sql_for_field(_values, _db_table, _db_field)
raise NotImplementedError
raise SubclassResponsibilityError
end
def self.connection
+1 -1
View File
@@ -50,7 +50,7 @@ module Queries
end
def self.key
raise NotImplementedError
raise SubclassResponsibilityError
end
def apply_to(query_scope)
@@ -56,7 +56,7 @@ module Queries::Projects::Filters::DynamicallyFromProjectPhase
end
def key
raise NotImplementedError
raise SubclassResponsibilityError
end
private
@@ -77,7 +77,7 @@ module Queries::Projects::Filters::DynamicallyFromProjectPhase
end
def create_from_phase(_phase, _context)
raise NotImplementedError
raise SubclassResponsibilityError
end
def accessor_matches?(definition, match)
@@ -74,23 +74,23 @@ module Queries::Projects::Filters::FilterOnProjectPhase
private
def on_date
raise NotImplementedError
raise SubclassResponsibilityError
end
def on_today
raise NotImplementedError
raise SubclassResponsibilityError
end
def between_date
raise NotImplementedError
raise SubclassResponsibilityError
end
def this_week
raise NotImplementedError
raise SubclassResponsibilityError
end
def none
raise NotImplementedError
raise SubclassResponsibilityError
end
def project_phase_scope_limit(scope)
@@ -54,7 +54,7 @@ module Queries
private
def visibility_checked_sql(_operator, _values, _visible_sql)
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
+1 -1
View File
@@ -32,7 +32,7 @@ class Queries::Selects::Base
include ActiveModel::Validations
def self.key
raise NotImplementedError
raise SubclassResponsibilityError
end
def self.available?
@@ -68,7 +68,7 @@ class Queries::WorkPackages::Filter::AttachmentBaseFilter < Queries::WorkPackage
end
def search_column
raise NotImplementedError
raise SubclassResponsibilityError
end
def normalization_type
@@ -47,7 +47,7 @@ module Queries::WorkPackages::Filter::FilterOnDirectedRelationsMixin
end
def relation_type
raise NotImplementedError
raise SubclassResponsibilityError
end
def normalized_relation_type
@@ -57,10 +57,10 @@ module Queries::WorkPackages::Filter::FilterOnDirectedRelationsMixin
private
def relation_filter
raise NotImplementedError
raise SubclassResponsibilityError
end
def relation_select
raise NotImplementedError
raise SubclassResponsibilityError
end
end
@@ -42,7 +42,7 @@ module Queries::WorkPackages::Filter::FilterOnUndirectedRelationsMixin
end
def relation_type
raise NotImplementedError
raise SubclassResponsibilityError
end
private
@@ -50,7 +50,7 @@ module Queries::WorkPackages::Filter::OrFilterForWpMixin
end
def filter_configurations
raise NotImplementedError
raise SubclassResponsibilityError
end
def create_instances
@@ -40,36 +40,36 @@ module SharingStrategies
def available_roles
# format: [{ label: "Role name", value: 42, description: "Role description", default: true }]
raise NotImplementedError, "Override in a subclass and return an array of roles that should be displayed"
raise SubclassResponsibilityError, "Override in a subclass and return an array of roles that should be displayed"
end
def viewable?
raise NotImplementedError,
raise SubclassResponsibilityError,
"Override in a subclass and return true if the current user can view who the entity is shared with"
end
def manageable?
raise NotImplementedError, "Override in a subclass and return true if the current user can manage sharing"
raise SubclassResponsibilityError, "Override in a subclass and return true if the current user can manage sharing"
end
def create_contract_class
raise NotImplementedError, "Override in a subclass and return the contract class for creating a share"
raise SubclassResponsibilityError, "Override in a subclass and return the contract class for creating a share"
end
def update_contract_class
raise NotImplementedError, "Override in a subclass and return the contract class for updating a share"
raise SubclassResponsibilityError, "Override in a subclass and return the contract class for updating a share"
end
def delete_contract_class
raise NotImplementedError, "Override in a subclass and return the contract class for deleting a share"
raise SubclassResponsibilityError, "Override in a subclass and return the contract class for deleting a share"
end
def share_description(share)
raise NotImplementedError, "Override in a subclass and return a description for the shared user"
raise SubclassResponsibilityError, "Override in a subclass and return a description for the shared user"
end
def title
raise NotImplementedError, "Override in a subclass and return a title for the sharing dialog"
raise SubclassResponsibilityError, "Override in a subclass and return a title for the sharing dialog"
end
def enterprise_feature
+2 -2
View File
@@ -57,10 +57,10 @@ class Type::FormGroup
end
def members
raise NotImplementedError
raise SubclassResponsibilityError
end
def active_members(_project)
raise NotImplementedError
raise SubclassResponsibilityError
end
end
+2 -2
View File
@@ -103,10 +103,10 @@ class UserPassword < ApplicationRecord
# Require the implementation to provide a secure comparison
def hash_matches?(_plain)
raise NotImplementedError, "Must be overridden by subclass"
raise SubclassResponsibilityError
end
def derive_password!(_input)
raise NotImplementedError, "Must be overridden by subclass"
raise SubclassResponsibilityError
end
end
+1 -1
View File
@@ -45,7 +45,7 @@ module Users::FunctionUser
def builtin? = true
def name(*_args); raise NotImplementedError end
def name(*_args) = raise SubclassResponsibilityError
def mail = nil
+1 -1
View File
@@ -51,7 +51,7 @@ class SCM::AuthorizationPolicy
# Determines whether the given request is a read access
# Must be implemented by descendents of this policy.
def readonly_request?(_params)
raise NotImplementedError
raise SubclassResponsibilityError
end
##
+1 -1
View File
@@ -68,7 +68,7 @@ module BasicData
end
def model_attributes(model_data)
raise NotImplementedError
raise SubclassResponsibilityError
end
def applicable?
+1 -1
View File
@@ -29,7 +29,7 @@
#++
class BasicDataSeeder < CompositeSeeder
def data_seeder_classes
raise NotImplementedError
raise SubclassResponsibilityError
end
def namespace
+2 -2
View File
@@ -50,7 +50,7 @@ class CompositeSeeder < Seeder
end
def data_seeder_classes
raise NotImplementedError, "has to be implemented by subclasses"
raise SubclassResponsibilityError
end
def discovered_seeders
@@ -71,7 +71,7 @@ class CompositeSeeder < Seeder
end
def namespace
raise NotImplementedError, "has to be implemented by subclasses"
raise SubclassResponsibilityError
end
##
+1 -1
View File
@@ -68,7 +68,7 @@ class Seeder
end
def seed_data!
raise NotImplementedError
raise SubclassResponsibilityError
end
def applicable?
@@ -60,7 +60,7 @@ module API
private
def deduce_representer(_model)
raise NotImplementedError
raise SubclassResponsibilityError
end
def parsing_representer
+1 -1
View File
@@ -59,7 +59,7 @@ module BaseServices
attr_accessor :params
def perform(*)
raise NotImplementedError
raise SubclassResponsibilityError
end
private
@@ -117,7 +117,7 @@ module BaseServices
end
def default_contract_class
raise NotImplementedError
raise SubclassResponsibilityError
end
def namespace
+2 -2
View File
@@ -67,11 +67,11 @@ module BaseServices
end
def instance(_params)
raise NotImplementedError
raise SubclassResponsibilityError
end
def default_contract_class
raise NotImplementedError
raise SubclassResponsibilityError
end
def instance_class
@@ -107,12 +107,12 @@ module BulkServices
# @return [Symbol] the permission required to create the mapping
def permission
raise NotImplementedError
raise SubclassResponsibilityError
end
# @return [Symbol] the column name of the mapping
def model_foreign_key_id
raise NotImplementedError
raise SubclassResponsibilityError
end
def attributes_service_class
@@ -39,11 +39,11 @@ module BulkServices
end
def mapping_attributes_for_all_projects(params)
raise NotImplementedError, "This method must be implemented in a subclass"
raise SubclassResponsibilityError
end
def incoming_projects
raise NotImplementedError, "This method must be implemented in a subclass"
raise SubclassResponsibilityError
end
end
end
+1 -1
View File
@@ -96,7 +96,7 @@ module Copy
end
def copy_dependency(params:)
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
@@ -159,9 +159,9 @@ module CustomFields
Success()
end
def soft_delete_item(item:)
# Soft delete the item and children
raise NotImplementedError
def soft_delete_item(item:)
raise SubclassResponsibilityError
end
# Returns a hash of Item => { Item => [Item] }
@@ -65,7 +65,7 @@ module Groups::Concerns
end
def modify_members_and_roles(_params)
raise NotImplementedError
raise SubclassResponsibilityError
end
def execute_query(query)
@@ -41,12 +41,12 @@ module IncomingEmails::Handlers
# Override in subclasses to determine if this handler can process the email
def self.handles?(email, reference:, automated_email:)
raise NotImplementedError, "Subclasses must implement can_handle? method"
raise SubclassResponsibilityError, "Subclasses must implement handles? method"
end
# Override in subclasses to process the email
def process
raise NotImplementedError, "Subclasses must implement handle method"
raise SubclassResponsibilityError, "Subclasses must implement process method"
end
def cleaned_up_text_body
+1 -1
View File
@@ -45,7 +45,7 @@ module Ldap
end
def perform
raise NotImplementedError
raise SubclassResponsibilityError
end
protected
@@ -55,7 +55,7 @@ module Members::Concerns::NotificationSender
end
def event_type
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
+4 -4
View File
@@ -47,18 +47,18 @@ class Reports::Report
# ---- every report needs to implement these methods to supply all needed data for a report -----
def field
raise NotImplementedError
raise SubclassResponsibilityError
end
def rows
raise NotImplementedError
raise SubclassResponsibilityError
end
def data
raise NotImplementedError
raise SubclassResponsibilityError
end
def title
raise NotImplementedError
raise SubclassResponsibilityError
end
end
@@ -73,11 +73,11 @@ module WorkPackages
end
def alter_work_package(_work_package, _params)
raise NotImplementedError
raise SubclassResponsibilityError
end
def call_move_hook(_work_package, _params)
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
+1 -1
View File
@@ -66,7 +66,7 @@ module Exports
attr_accessor :export, :current_user, :mime_type, :query, :options
def prepare!
raise NotImplementedError
raise SubclassResponsibilityError
end
def list_export?
+2 -2
View File
@@ -57,12 +57,12 @@ class Mails::DeliverJob < ApplicationJob
# To be implemented by subclasses.
# Returns a Mail::Message, or nil if no message should be sent.
def render_mail
raise NotImplementedError, "SubclassResponsibility"
raise SubclassResponsibilityError
end
def build_mail
render_mail
rescue NotImplementedError
rescue SubclassResponsibilityError
# Notify subclass of the need to implement
raise
rescue StandardError => e
+2 -2
View File
@@ -69,11 +69,11 @@ class Mails::MemberJob < ApplicationJob
end
def send_for_group_user(_current_user, _member, _group, _message)
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def send_for_project_user(_current_user, _member, _message)
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def send_updated_global(current_user, member, member_message)
+1 -1
View File
@@ -73,6 +73,6 @@ class Mails::WatcherJob < Mails::DeliverJob
end
def action
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
end
+1 -1
View File
@@ -72,7 +72,7 @@ module WorkPackages
end
def service_class
raise NotImplementedError
raise SubclassResponsibilityError
end
def successful_status_update(call)
+1 -1
View File
@@ -56,6 +56,6 @@ class Tables::Base
end
def self.table(_migration)
raise NotImplementedError
raise SubclassResponsibilityError
end
end
+5 -5
View File
@@ -53,15 +53,15 @@ module API
end
def commit_method
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def form_url
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def resource_url
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def payload_representer
@@ -79,11 +79,11 @@ module API
end
def contract_class
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def model
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
private
+2
View File
@@ -303,6 +303,8 @@ module API
error_response ActiveRecord::RecordNotFound, ::API::Errors::NotFound, log: false
error_response ActiveRecord::StaleObjectError, ::API::Errors::Conflict, log: false
# TODO: Where do we expect this to be raised and **not** be a programming error?
error_response NotImplementedError, ::API::Errors::NotImplemented, log: false
error_response MultiJson::ParseError, ::API::Errors::ParseError
+7 -7
View File
@@ -33,7 +33,7 @@ module API
include NamespacedLookup
def default_instance_generator(_model)
raise NotImplementedError
raise SubclassResponsibilityError
end
def default_params_modifier
@@ -146,11 +146,11 @@ module API
private
def present_success(_request, _call)
raise NotImplementedError
raise SubclassResponsibilityError
end
def present_error(_call)
raise NotImplementedError
raise SubclassResponsibilityError
end
def success?(call)
@@ -166,15 +166,15 @@ module API
end
def deduce_parse_representer
raise NotImplementedError
raise SubclassResponsibilityError
end
def deduce_parse_service
raise NotImplementedError
raise SubclassResponsibilityError
end
def deduce_render_representer
raise NotImplementedError
raise SubclassResponsibilityError
end
def deduce_api_namespace
@@ -182,7 +182,7 @@ module API
end
def update_or_create
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
+2 -2
View File
@@ -44,7 +44,7 @@ module API
end
def mount
raise NotImplementedError
raise SubclassResponsibilityError
end
attr_accessor :model,
@@ -55,7 +55,7 @@ module API
private
def deduce_render_representer
raise NotImplementedError
raise SubclassResponsibilityError
end
def deduce_api_namespace
+1 -1
View File
@@ -39,7 +39,7 @@ module API
private
def present_success(_request, _call)
raise NotImplementedError
raise SubclassResponsibilityError
end
def present_error(call)
+1 -1
View File
@@ -74,7 +74,7 @@ module API
private
def deduce_render_representer
raise NotImplementedError
raise SubclassResponsibilityError
end
def deduce_api_namespace
+1 -1
View File
@@ -60,7 +60,7 @@ module API
end
def meta_representer_class
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
@@ -44,7 +44,7 @@ module API
end
def json_cache_key
raise NotImplementedError
raise SubclassResponsibilityError
end
private
+4 -4
View File
@@ -63,19 +63,19 @@ module API
end
def commit_action
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def commit_method
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def form_url
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def resource_url
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def payload_representer
@@ -82,11 +82,11 @@ module API
end
def type
raise NotImplementedError, "Subclass has to implement #type"
raise SubclassResponsibilityError, "Subclass has to implement #type"
end
def href_callback
raise NotImplementedError, "Subclass has to implement #href_callback"
raise SubclassResponsibilityError, "Subclass has to implement #href_callback"
end
attr_accessor :operator
@@ -47,7 +47,7 @@ module API
private
def filter_query
raise NotImplementedError, "Subclasses need to implement #filter_query"
raise SubclassResponsibilityError, "Subclasses need to implement #filter_query"
end
end
end
@@ -56,7 +56,7 @@ module API
attr_accessor :form_embedded
def model_self_link(_model)
raise NotImplementedError, "Subclass has to implement this"
raise SubclassResponsibilityError
end
end
end
@@ -39,7 +39,7 @@ module API
end
def apply(_work_package)
raise NotImplementedError
raise SubclassResponsibilityError
end
def self.module
@@ -80,7 +80,7 @@ module API
private
def contract
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
+3 -3
View File
@@ -92,15 +92,15 @@ module OpenProject
end
def discriminator(request)
raise NotImplementedError
raise SubclassResponsibilityError
end
def default_limit
raise NotImplementedError
raise SubclassResponsibilityError
end
def default_period
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
@@ -59,7 +59,7 @@ module OpenProject
##
# Returns the checkout command for this vendor
def checkout_command
raise NotImplementedError
raise SubclassResponsibilityError
end
private
@@ -32,11 +32,11 @@ module OpenProject::TextFormatting::Formats
class BaseFormat
class << self
def format
raise NotImplementedError
raise SubclassResponsibilityError
end
def priority
raise NotImplementedError
raise SubclassResponsibilityError
end
def helper
@@ -39,7 +39,7 @@ module OpenProject::TextFormatting::Formats
end
def to_html(text)
raise NotImplementedError
raise SubclassResponsibilityError
end
protected
@@ -62,7 +62,7 @@ module OpenProject::TextFormatting::Matchers
##
# Test whether we should try to resolve the given link
def applicable?
raise NotImplementedError
raise SubclassResponsibilityError
end
##
@@ -70,7 +70,7 @@ module OpenProject::TextFormatting::Matchers
# and matchers.
# If nil is returned, the link remains as-is.
def call
raise NotImplementedError
raise SubclassResponsibilityError
end
def oid
@@ -63,13 +63,13 @@ module OpenProject::TextFormatting
##
# Get the regexp that matches the content
def self.regexp
raise NotImplementedError
raise SubclassResponsibilityError
end
##
# Called with a match from the regexp on the node's content
def self.process_match(matchdata, matched_string, context)
raise NotImplementedError
raise SubclassResponsibilityError
end
##
+36
View File
@@ -0,0 +1,36 @@
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
class SubclassResponsibilityError < StandardError
def initialize(message = nil)
message ||= "The subclass needs to implement this method."
super
end
end
@@ -32,7 +32,7 @@ module ::Avatars
private
def redirect_path
raise NotImplementedError
raise SubclassResponsibilityError
end
def ensure_enabled
@@ -39,7 +39,7 @@ module Bim::Bcf::API::V2_1
protected
def scope
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
@@ -11,7 +11,7 @@ module OpenProject::Bim::BcfXml
protected
def root_node
raise NotImplementedError
raise SubclassResponsibilityError
end
def root_node_attributes
+3 -3
View File
@@ -18,15 +18,15 @@ module CostScopes
end
def view_allowed_entries_permission
raise NotImplementedError
raise SubclassResponsibilityError
end
def view_allowed_own_entries_permission
raise NotImplementedError
raise SubclassResponsibilityError
end
def view_rates_permissions
raise NotImplementedError
raise SubclassResponsibilityError
end
def with_visible_costs_on(scope, user: User.current, project: nil)
+1 -1
View File
@@ -61,7 +61,7 @@ module Entry::Costs
end
def cost_attribute
raise NotImplementedError
raise SubclassResponsibilityError
end
end
end
@@ -50,15 +50,15 @@ class WorkPackage
#
# @return [Class] Class of the model the costs are based on, e.g. CostEntry or TimeEntry.
def costs_model
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def costs_sum_alias
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
def subselect_alias
raise NotImplementedError, "subclass responsibility"
raise SubclassResponsibilityError
end
private
@@ -49,7 +49,7 @@ module Grids
# @abstract Subclasses must implement this method.
# @return [String] a title suitable for display to users.
def title
raise NotImplementedError, "#{self.class} must implement #{__method__}"
raise SubclassResponsibilityError, "#{self.class} must implement #{__method__}"
end
def widget_wrapper(**, &)
@@ -33,7 +33,7 @@ class Grids::WidgetController < Grids::BaseInOptionalProjectController
include OpTurbo::FlashStreamHelper
def show
raise NotImplementedError
raise SubclassResponsibilityError
end
private
@@ -93,7 +93,7 @@ module Grids::Configuration
end
def from_scope(_scope)
raise NotImplementedError
raise SubclassResponsibilityError
end
def all_scopes
+1 -1
View File
@@ -40,6 +40,6 @@ class Report::Filter
end
def self.from_hash
raise NotImplementedError
raise SubclassResponsibilityError
end
end
+1 -1
View File
@@ -175,7 +175,7 @@ class Report::Filter
end
def to_hash
raise NotImplementedError
raise SubclassResponsibilityError
end
def transformed_values
@@ -32,6 +32,6 @@ class Report::Filter::NoFilter < Report::Filter::Base
singleton
def sql_statement
raise NotImplementedError, "My subclass should have overwritten 'sql_statement'"
raise SubclassResponsibilityError, "Subclass should have overwritten 'sql_statement'"
end
end
+1 -1
View File
@@ -42,6 +42,6 @@ class Report::GroupBy
end
def self.from_hash
raise NotImplementedError
raise SubclassResponsibilityError
end
end

Some files were not shown because too many files have changed in this diff Show More