Showing 38 of 66 total issues
Class BaseClaimPresenter
has 79 methods (exceeds 24 allowed). Consider refactoring. Open
class Claim::BaseClaimPresenter < BasePresenter
presents :claim
include InjectionAttemptErrorable
Class BaseClaimValidator
has 53 methods (exceeds 24 allowed). Consider refactoring. Open
class BaseClaimValidator < BaseValidator
def self.mandatory_fields
%i[external_user_id creator amount_assessed evidence_checklist_ids earliest_representation_order_date]
end
File base_claim_presenter.rb
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Claim::BaseClaimPresenter < BasePresenter
presents :claim
include InjectionAttemptErrorable
Class BaseFeeValidator
has 28 methods (exceeds 24 allowed). Consider refactoring. Open
class BaseFeeValidator < BaseValidator
def self.fields
%i[
amount
warrant_issued_date
Method update_and_transition_state
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update_and_transition_state
event = Claims::InputEventMapper.input_event(state)
claim.class.transaction do
update_assessment if assessment_params
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Consider simplifying this complex logical expression. Open
if ((isNaN(min) && isNaN(max)) ||
(isNaN(min) && claimAmount <= max) ||
(min <= claimAmount && isNaN(max)) ||
(min <= claimAmount && claimAmount <= max)) {
return true
Method search
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def search(term, states = [], *options)
raise 'Invalid search option' if (options - QUERY_MAPPINGS_FOR_SEARCH.keys).any?
term = term.to_s.strip.downcase
if term.present?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method validate_resource
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_resource(model_klass, api_response, arg_builder_proc)
#
# basic fees (which are instantiated at claim creation)
# must be updated if they already exist.
# all other model class instances must be created.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method soft_delete
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def soft_delete
transaction do
before_soft_delete if respond_to?(:before_soft_delete)
result = if is_a?(Claim::BaseClaim)
update_attribute(:deleted_at, Time.zone.now)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method validate_fee_rate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_fee_rate(code = nil)
if @record.quantity.positive? && @record.rate <= 0
add_error(:rate, code ? :"#{code.downcase}_invalid" : :invalid)
elsif @record.quantity <= 0 && @record.rate.positive?
add_error(:quantity, code ? :"#{code.downcase}_invalid" : :invalid)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method equal_for_scheme_ten
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def equal_for_scheme_ten(other)
return true unless other.fee_scheme_version == 10
return false if elected_case
if other.elected_case
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ==
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ==(other)
return false unless litigator_type == other.litigator_type
return false unless equal_for_scheme_nine(other)
return false unless equal_for_scheme_ten(other)
return false unless transfer_stage_id == other.transfer_stage_id
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(object)
@error_messages = []
if VALID_MODEL_KLASSES.include?(object.class)
@model = object
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method instantiate_basic_fees
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def instantiate_basic_fees
return unless case_type.present? && !case_type.is_fixed_fee?
return unless editable?
fee_type_ids = basic_fees.map(&:fee_type_id)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method instantiate_basic_fees
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def instantiate_basic_fees
return unless case_type.present? && !case_type.is_fixed_fee?
return unless editable?
fee_type_ids = basic_fees.map(&:fee_type_id)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(attribute, long_message, short_message, api_message, sequence = 99_999)
Method equal_for_scheme_nine
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def equal_for_scheme_nine(other)
return true unless other.fee_scheme_version == 9
return false unless elected_case == other.elected_case
return false unless elected_case || conclusion == other.conclusion
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method test_editability
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def test_editability(model_instance)
return unless fee_classes.include?(model_instance.class)
model_instance.errors.add(:base, 'uneditable_state') unless model_instance.claim.editable?
rescue StandardError
true
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create_resource
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_resource(model_klass, params, api_response, arg_builder_proc)
model_instance = validate_resource(model_klass, api_response, arg_builder_proc)
if api_response.success?(200)
created_or_updated_status = model_instance.new_record? ? 201 : 200
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"