Showing 8 of 15 total issues
Method walk
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def walk(node, data)
case node
when Hash
hash = {}
node.each do |key,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 all_of
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def all_of(target, source, opts = {})
params = parameters(opts)
if params[source]
equal(target, source, opts)
- 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 convert
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert
match('company_name', 'name')
equal('limit', 'limit') # default 100
equal('index', 'page', transform: lambda{|v| (Integer(v) - 1) * (Integer(input['limit'] || 100))})
Method walk
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def walk(node, data)
case node
when Hash
hash = {}
node.each do |key,value|
Consider simplifying this complex logical expression. Open
elsif params["#{source}>="] || params["#{source}>"] || params["#{source}<="] || params["#{source}<"]
output[target] = "#{params["#{source}>="] || params["#{source}>"]}:#{params["#{source}<="] || params["#{source}<"]}"
Method convert
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def convert
match('company_name', 'name')
equal('limit', 'limit') # default 100
equal('index', 'page', transform: lambda{|v| (Integer(v) - 1) * (Integer(input['limit'] || 100))})
- 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!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate!(opts = {})
# The code assumes that processing errors in reverse avoids re-indexing
# issues when deleting items from arrays. If this assumption is invalid,
# we can delete items one at a time and re-validate using this skeleton:
#
- 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 convert
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def convert
equal('per_page', 'limit', default: input['open_corporates_api_key'] && 100) # default 30, maximum 100
equal('page', 'page')
input['subject'] && input['subject'].each do |subject|
- 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"