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 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"