Showing 33 of 33 total issues
Method each
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def each(str)
raise ArgumentError, "RegexpEnumerator#each expects a String, but got #{str.inspect}" unless str.kind_of? String
return self.to_enum(:each,str) unless block_given?
rest = str
loop do
- 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
File expression.rb
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'uri_template/rfc6570'
class URITemplate::RFC6570
# @private
Method expand_partial
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def expand_partial( vars )
result = []
rest = []
defined = false
@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
File arena.rb
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
gem 'rspec-expectations'
require 'rspec-expectations'
module Arena
Class Expression
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Expression < Token
include URITemplate::Expression
attr_reader :variables
Method to_r_source
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def to_r_source
source = regex_builder
source.group do
source.escaped_prefix
first = true
- 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 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
File rfc6570.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'strscan'
require 'set'
require 'forwardable'
require 'uri_template'
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 to_r_source
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def to_r_source
vs = @variable_specs.size - 1
i = 0
source = regex_builder
source.group do
- 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 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 to_r_source
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_r_source
vs = @variable_specs.size - 1
i = 0
source = regex_builder
source.group do
Method extract_matchdata
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def extract_matchdata(matchdata, post_processing)
bc = 1
vars = []
tokens.each{|part|
next if part.literal?
- 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_convert
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def try_convert(x)
if x.class == self
return x
elsif x.kind_of? String and valid? x
return new(x)
- 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 extract
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def extract(uri_or_match, post_processing = DEFAULT_PROCESSING )
if uri_or_match.kind_of? String
m = self.to_r.match(uri_or_match)
elsif uri_or_match.kind_of?(MatchData)
if uri_or_match.respond_to?(:regexp) and uri_or_match.regexp != self.to_r
- 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_r_source
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_r_source
source = regex_builder
source.group do
source.escaped_prefix
first = true
Method expand_partial
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def expand_partial( vars )
result = []
rest = []
defined = false
@variable_specs.each do | var, expand , max_length |
Method extract
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def extract(uri)
md = self.to_r.match(uri)
return nil unless md
result = {}
splat = []
- 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 |