File algorithm.rb
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rkelly'
module Setup
class Algorithm
include SnippetCode
Method do_store_output
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def do_store_output(output)
rc = []
r = nil
while output.capataz_proxy?
- 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
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def run(input = [], task = nil)
input = Cenit::Utility.json_value_of(input)
input = [input] unless input.is_a?(Array)
input = input.dup
input_size = input.length
- 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 Algorithm
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Algorithm
include SnippetCode
include NamespaceNamed
include Taggable
# = Algorithm
Method do_store_output
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_store_output(output)
rc = []
r = nil
while output.capataz_proxy?
Method run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(input = [], task = nil)
input = Cenit::Utility.json_value_of(input)
input = [input] unless input.is_a?(Array)
input = input.dup
input_size = input.length
Method validate_code
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_code
if code.blank?
errors.add(:code, "can't be blank")
else
logs = parse_code
- 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 validate_parameters
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_parameters
not_required = false
parameters.each do |p|
next unless not_required ||= !p.required
p.errors.add(:required, 'marked as "Required" must come before non marked') if p.required
- 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 parse_code
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_code
if language == :auto
logs = {}
lang = self.class.language_enum.values.detect do |language|
next if language == :auto
- 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_call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def for_each_call(visited = Set.new, &block)
unless visited.include?(self)
visited << self
block.call(self) if block
call_links.each { |call_link| call_link.link.for_each_call(visited, &block) if call_link.link }
- 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 parse_javascript_code
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_javascript_code
logs = { errors: errors = [] }
ast =
begin
RKelly.parse(code)
- 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_asynchronous
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_asynchronous(*args, &block)
options =
if args.last.is_a?(Hash)
args.pop
else
- 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"