Method scheme_and_host
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def scheme_and_host
return @scheme_and_host if @scheme_and_host
read_chars = ""
@scheme_and_host = [false,false]
tokens.each do |token|
- 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 coerce
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.coerce(a,b)
if a.kind_of? URITemplate
if a.class == b.class
return [a,b,false,false]
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 scheme_and_host
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scheme_and_host
return @scheme_and_host if @scheme_and_host
read_chars = ""
@scheme_and_host = [false,false]
tokens.each do |token|
Method path_concat
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def path_concat(other)
if other.host? or other.scheme?
raise ArgumentError, "Expected to receive a relative template but got an absoulte one: #{other.inspect}. If you think this is a bug, please report it."
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
Avoid too many return
statements within this method. Open
return self.class.new( (self.tokens + other.tokens).join )
Method normalize_variables
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def normalize_variables( variables )
raise ArgumentError, "Expected something that responds to :map, but got: #{variables.inspect}" unless variables.respond_to? :map
if variables.kind_of?(Array)
return Hash[self.variables.zip(variables)]
else
- 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"