Showing 7 of 9 total issues
Method run_block_with_retry
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def run_block_with_retry(object, local_context, transaction_open, retriable_errors, reraisable_errors, already_been_added_to_self, needing_added_to_self, num_retry_attempts)
attempt = 0
re_try = false
begin
attempt += 1
- 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 run_block_with_retry
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_block_with_retry(object, local_context, transaction_open, retriable_errors, reraisable_errors, already_been_added_to_self, needing_added_to_self, num_retry_attempts)
attempt = 0
re_try = false
begin
attempt += 1
Method transaction_wrapper
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transaction_wrapper(object: nil, **args)
lock = args.delete(:lock)
inside_args = extract_args(args, INSIDE_TRANSACTION_ERROR_HANDLERS)
outside_args = extract_args(args, OUTSIDE_TRANSACTION_ERROR_HANDLERS)
transaction_args = extract_args(args, TRANSACTION_METHOD_ARG_NAMES)
Method run_block_with_retry
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_block_with_retry(object, local_context, transaction_open, retriable_errors, reraisable_errors, already_been_added_to_self, needing_added_to_self, num_retry_attempts)
Method transaction_error_logger
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def transaction_error_logger(object:, error:, result:, attempt: nil, add_to: :base, additional_message: nil, **_opts)
# Ruby arguments, like object, are passed by reference,
# so this update to errors will be available to the caller
if object.nil?
# when a transaction wraps a bunch of CRUD actions,
- 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 transaction_wrapper
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def transaction_wrapper(object: nil, **args)
lock = args.delete(:lock)
inside_args = extract_args(args, INSIDE_TRANSACTION_ERROR_HANDLERS)
outside_args = extract_args(args, OUTSIDE_TRANSACTION_ERROR_HANDLERS)
transaction_args = extract_args(args, TRANSACTION_METHOD_ARG_NAMES)
- 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 run_inside_transaction_block
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run_inside_transaction_block(transaction_args:, inside_args:, lock:, transaction_open:, object: nil, &block)
if object
if lock
# NOTE: with_lock will reload object!
# Note: with_lock does not accept arguments like transaction does.
- 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"