Method url_for
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def url_for(params)
host_with_port = host || location.host
host_with_port += ":#{port}" if port && port != 80
scheme = scheme || location.scheme
- 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 assign_from_old
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def assign_from_old(params, new_params)
queued_deletes = []
params.attributes.each_pair do |name, old_val|
# If there is a new value, see if it has [name]
- 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
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(url)
if url[0] == '#'
# url only updates fragment
self.fragment = url[1..-1]
update!
Method url_for
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def url_for(params)
host_with_port = host || location.host
host_with_port += ":#{port}" if port && port != 80
scheme = scheme || location.scheme
Method parse_query
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_query
query_hash = {}
qury = query
if qury
- 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 nested_params_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def nested_params_hash(params, path = [])
results = {}
params.each_pair do |key, value|
unless value.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 parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse(url)
if url[0] == '#'
# url only updates fragment
self.fragment = url[1..-1]
update!
- 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"