Method update_using_json_path
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update_using_json_path(hash, at, opts)
if hash.is_a?(Hash)
if at.present?
JsonPath.for(hash.with_indifferent_access).gsub!(at) do |i|
i.is_a?(Array) ? inject_attributes_for(i, at, opts) : inject_attributes_at(i, opts) unless (i.nil? or i.empty?)
- 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 inject_attributes_at
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def inject_attributes_at(hash_offset, opts)
return hash_offset if hash_offset.nil? or hash_offset.empty?
opts.each do |opt|
keys = hash_offset[opt[:using]]
entity_name = __entity__(opt[:bucket_name] || opt[:using])
- 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 smart_lookup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def smart_lookup(array_of_hashes, opts, all_values, at)
## populate is not a array
array_of_hashes.collect do |elt|
if at.present?
JsonPath.for(elt.with_indifferent_access).gsub!(at) do |node|
Method smart_lookup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def smart_lookup(array_of_hashes, opts, all_values, at)
## populate is not a array
array_of_hashes.collect do |elt|
if at.present?
JsonPath.for(elt.with_indifferent_access).gsub!(at) do |node|
- 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 do_populate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def do_populate(elt, values, using, as, populate)
Method inject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def inject(opts)
raise 'Incorrect usage' unless [:after, :using, :populate].all? { |e| opts.keys.include? e }
after = opts[:after]
@rules ||= {}
- 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"