Method get
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def get(key, options = {}, not_found = :reject, found = :return)
@options = options
return_nil_values = @options && @options[:nil_values]
transformation = @options && @options[:transformation] && @options[:transformation].methods.find_index(:call) ? @options[:transformation] : nil
raw = get_raw(key, options)
- 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 get_all
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_all(key, options = {}, not_found = :reject, found = :return)
@options = options
@options[:recurse] = true
return_nil_values = @options && @options[:nil_values]
transformation = @options && @options[:transformation] && @options[:transformation].methods.find_index(:call) ? @options[:transformation] : nil
- 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 get
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get(key, options = {}, not_found = :reject, found = :return)
@options = options
return_nil_values = @options && @options[:nil_values]
transformation = @options && @options[:transformation] && @options[:transformation].methods.find_index(:call) ? @options[:transformation] : nil
raw = get_raw(key, options)
Method get_all
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_all(key, options = {}, not_found = :reject, found = :return)
@options = options
@options[:recurse] = true
return_nil_values = @options && @options[:nil_values]
transformation = @options && @options[:transformation] && @options[:transformation].methods.find_index(:call) ? @options[:transformation] : nil
Method decode_transaction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def decode_transaction(transaction)
return transaction if transaction['Results'].nil? || transaction['Results'].empty?
transaction.tap do |txn|
txn['Results'].each do |resp|
- 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 transaction_verification
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def transaction_verification(transaction)
raise Diplomat::InvalidTransaction unless transaction.is_a?(Array)
transaction.each do |req|
raise Diplomat::InvalidTransaction unless transaction_type_verification(req)
- 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
Avoid too many return
statements within this method. Open
return convert_to_hash(return_value(return_nil_values, transformation, true)) if @options && @options[:convert_to_hash]
Avoid too many return
statements within this method. Open
return return_value(return_nil_values, transformation)
Method transaction_consistency
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def transaction_consistency(options)
return [] unless options
if options[:consistency] && options[:consistency] == 'stale'
['stale']
- 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"