Showing 9 of 9 total issues
Method compare_by_args_in_parts
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def compare_by_args_in_parts(self_and_other_parts)
result = 0
self_and_other_parts.each do |self_part, other_part|
if self_part.arg?
- 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 run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run
@parts.each do |part|
next static_part_found unless part.arg?
break if part.opt_arg? && @other_parts.count <= @other_index
- 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 find_among_arg_keys
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_among_arg_keys(path_parts)
keys.find do |key|
next unless key.is_a?(Flame::Path::Part) && key.arg?
result = self[key].navigate(*path_parts)
- 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 try_route
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def try_route
http_method = request.http_method
http_method = :GET if http_method == :HEAD
return unless available_endpoint
- 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 first_extra_arguments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def first_extra_arguments
## Get hash of any extra arguments
all_extra_arguments.find do |type, extra_arguments|
found = extra_arguments.find do |place, args|
break { place: place, type: type, args: args } if args.any?
- 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 path_arguments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
memoize def path_arguments
@path.parts.each_with_object(req: [], opt: []) do |part, hash|
## Take only argument parts
next unless part.arg?
- 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 find
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find
found_controller_name = controller_name_variations.find do |variation|
@namespace.const_defined?(variation) unless variation.empty?
end
- 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 default_body_of_nearest_route
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def default_body_of_nearest_route
## Return nil if must be no body for current HTTP status
return if Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include?(status)
## Find the nearest route by the parts of requested path
- 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 redirect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def redirect(*args)
args[0] = args.first.to_s if args.first.is_a? URI
unless args.first.is_a? String
path_to_args_range = 0..(args.last.is_a?(Integer) ? -2 : -1)
args[path_to_args_range] = path_to(*args[path_to_args_range])
- 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"