Showing 23 of 23 total issues
Method get_next_pending
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_next_pending
task_queue = nil
transaction do
# Find next task_queue which is not running and not in state error
- 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 reset_immediately!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def reset_immediately!
self.where('state != ?', 'heartbeat').each do |tq|
tq.update_attributes state: 'aborted'
# Kill the TaskQueue with SIGKILL
- 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 yaml_new
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.yaml_new(klass, tag, val)
if ActiveRecord::VERSION::MAJOR == 3
klass.unscoped.find(val['attributes'][klass.primary_key])
else # Rails 2
klass.with_exclusive_scope { klass.find(val['attributes'][klass.primary_key]) }
- 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"