File expression.rb
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'uri_template/rfc6570'
class URITemplate::RFC6570
# @private
Class Expression
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Expression < Token
include URITemplate::Expression
attr_reader :variables
Method decode
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def decode(x, split = true)
if x.nil?
return extracted_nil
elsif split
result = []
- 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 expand_partial
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def expand_partial( vars )
result = []
follow_up = self.class::FOLLOW_UP
var_specs = []
@variable_specs.each do | var, expand , max_length |
- 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 expand_partial
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def expand_partial( vars )
result = []
follow_up = self.class::FOLLOW_UP
var_specs = []
@variable_specs.each do | var, expand , max_length |
Method extract
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract(position,matched)
name, expand, max_length = @variable_specs[position]
if matched.nil?
return [[ name , extracted_nil ]]
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 level
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def level
if @variable_specs.none?{|_,expand,ml| expand || (ml > 0) }
if @variable_specs.size == 1
return self.class::BASE_LEVEL
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"
Further reading
Method to_s
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_s
return '{' + self.class::OPERATOR + @variable_specs.map{|name,expand,max_length| name + (expand ? '*': '') + (max_length > 0 ? (':' + max_length.to_s) : '') }.join(',') + '}'
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"