Method safe_perform!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def safe_perform!
job_status('status' => STATUS_WORKING)
messages = ['Job starting']
@logger.info("#{@uuid}: #{messages.join(' ')}")
perform
- 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 lock!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def lock!(key = nil)
lock = Digest::SHA1.hexdigest @options.to_json
lock = key if key
if locked?(lock)
messages = ["Waiting at #{Time.now} due to existing job"]
- 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 safe_perform!
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def safe_perform!
job_status('status' => STATUS_WORKING)
messages = ['Job starting']
@logger.info("#{@uuid}: #{messages.join(' ')}")
perform
Method tick
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tick(*messages)
kill! if should_kill?
if should_pause?
pause!
elsif should_revert?
- 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 pause!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pause!(pause_text = nil)
Resque::Plugins::State::Hash.pause(uuid)
messages = ["Paused at #{Time.now} #{pause_text}"]
job_status('status' => STATUS_PAUSED,
'message' => messages[0])
- 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"