Method create_job
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_job(method, args)
# UUID's are guaranteed to be practically unique, as in *extremely* unlikely to collide
new_job_id = SecureRandom.uuid
# @is_parent_caller differentiates the parent job as originally called (outside a worker process) and the parent
# job as run by a worker process.
Method worker_manager
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def worker_manager(method, *args, &block)
new_job_id = create_job method, args
# Wait for job to finish before running subsequent tasks
if block_given? || @block_until_complete
socket = Peas::Switchboard.connection
- 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 handle_status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle_status(method, status, progress, &_block)
if status == 'failed'
if @is_parent_caller
# Only raise an error in the parent worker that started off the whole process
error_message = "Worker for #{@instance.class.name}.#{method} failed. Job aborted. " + progress['body']
- 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_job
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_job(method, args)
# UUID's are guaranteed to be practically unique, as in *extremely* unlikely to collide
new_job_id = SecureRandom.uuid
# @is_parent_caller differentiates the parent job as originally called (outside a worker process) and the parent
# job as run by a worker process.
- 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"