Showing 8 of 10 total issues
Method handle_errors
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def handle_errors(hash)
errors = []
hash.each do |key, value|
if value.is_a?(Hash)
- 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 ensure_schema
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def ensure_schema(value, child_schema)
if value.present? && child_schema.present?
value = if child_schema.is_a?(Array)
value.map do |item|
item.is_a?(SchemaModel) ? item : child_schema[0].new(item)
- 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_or_response
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fail_or_response(response)
if response.status != 200
raise(ErrorResponse.new("HTTP Status #{response.status}", response))
elsif response.body.kind_of?(Array)
if !response.body.first['Success']
- 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 symbolize_keys_deep
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def symbolize_keys_deep(hash)
return hash unless hash.is_a?(Hash)
Hash[hash.map do |key, value|
# if value is array, loop each element and recursively symbolize keys
- 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 query_to_string
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def query_to_string(fields, table, conditions)
raise 'Fields must be an Array' unless fields.is_a?(Array)
raise 'Table must respond to :to_sym' unless table.respond_to?(:to_sym)
raise 'Conditions must be Array' if fields && !fields.is_a?(Array)
- 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 api_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def api_url(sandbox)
if use_modern_rest?
sandbox ? Zuora::Rest::NEWEST_SANDBOX_URL : Zuora::Rest::NEWEST_API_URL
else
sandbox ? Zuora::Rest::SANDBOX_URL : Zuora::Rest::API_URL
- 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 check_validation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_validation(valid, value)
return unless valid && value
passes_validation = begin
valid.call(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 xml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.xml(header, body)
Nokogiri::XML::Builder.new do |builder|
builder[:soapenv].Envelope(Zuora::NAMESPACES) do
builder[:soapenv].Header { header.call builder } if header
builder[:soapenv].Body { body.call builder } if body
- 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"