Showing 14 of 16 total issues
File persistence.rb
has 508 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'builder'
module Taskinator
module Persistence
Method constantize
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def constantize(camel_cased_word)
# borrowed from activesupport/lib/active_support/inflector/methods.rb
names = camel_cased_word.split('::')
- 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
Class Process
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Process
include ::Comparable
include Workflow
include Persistence
Method define_process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def define_process(*arg_list, &block)
raise ProcessAlreadyDefinedError if respond_to?(:_create_process_)
factory = arg_list.last.respond_to?(:call) ?
arg_list.pop :
- 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 visit_tasks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def visit_tasks(tasks)
builder.tag!('tasks', :count => tasks.count) do |xml|
tasks.each do |task|
xml.tag!('task', :key => task.key) do |xml2|
XmlSerializationVisitor.new(xml2, task, @base_visitor).visit
- 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 deserialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def deserialize(yaml)
values = YAML.load(yaml)
if values.is_a?(Array)
values = values.collect {|value|
(value.respond_to?(:model_id) && value.respond_to?(:find)) ? value.find : value
- 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 define_process
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def define_process(*arg_list, &block)
raise ProcessAlreadyDefinedError if respond_to?(:_create_process_)
factory = arg_list.last.respond_to?(:call) ?
arg_list.pop :
Method serialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def serialize(values)
# special case, convert models to global id's
if values.is_a?(Array)
values = values.collect {|value|
value.respond_to?(:to_global_id) ? value.to_global_id : value
- 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 payload_for
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def payload_for(state, additional={})
# need to cache here, since this method hits redis, so can't be part of multi statement following
process_key = self.process_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"
Further reading
Method for_each
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def for_each(method, options={}, &block)
raise ArgumentError, 'method' if method.nil?
raise NoMethodError, method unless @executor.respond_to?(method)
raise ArgumentError, 'block' unless block_given?
- 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 visit_tasks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def visit_tasks(tasks)
tasks.each do |task|
RedisSerializationVisitor.new(@conn, task, @base_visitor).visit
@conn.rpush "#{@key}:tasks", task.uuid
unless task.is_a?(Task::SubProcess)
- 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 complete!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def complete!
transition(:completed) do
instrument('taskinator.process.completed', completed_payload) do
complete if respond_to?(:complete)
# notify the parent task (if there is one) that this process has completed
- 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 fail!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fail!(error)
transition(:failed) do
instrument('taskinator.process.failed', failed_payload(error)) do
fail(error) if respond_to?(:fail)
# notify the parent task (if there is one) that this process has failed
- 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!
return unless enqueued? || processing?
transition(:paused) do
instrument('taskinator.process.paused', paused_payload) do
- 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"