File regexp.rb
has 446 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Regexp
def self.allocate
Rubinius.primitive :regexp_allocate
raise PrimitiveFailure, "Regexp.allocate primitive failed"
end
Class Regexp
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Regexp
def self.allocate
Rubinius.primitive :regexp_allocate
raise PrimitiveFailure, "Regexp.allocate primitive failed"
end
Method initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def initialize(pattern, opts=nil, lang=nil)
if pattern.kind_of?(Regexp)
opts = pattern.options
pattern = pattern.source
elsif pattern.kind_of?(Fixnum) or pattern.kind_of?(Float)
- 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 union
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.union(*patterns)
case patterns.size
when 0
return %r/(?!)/
when 1
Method create_parts
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_parts
while @index < @source.size
if @source[@index].chr == '('
escaped = @index > 0 && @source[@index - 1].chr == '\\'
- 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 union
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.union(*patterns)
case patterns.size
when 0
return %r/(?!)/
when 1
- 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 match
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def match(str, pos=0)
unless str
Regexp.last_match = nil
return 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 match?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def match?(str, pos=0)
return false unless str
str = str.to_s if str.is_a?(Symbol)
str = StringValue(str)
- 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 ===
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ===(other)
if other.kind_of? Symbol
other = other.to_s
elsif !other.kind_of? String
other = Rubinius::Type.check_convert_type other, String, :to_str
- 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 in_group_with_options?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def in_group_with_options?
return false if @source[@index, 1] != '?'
@source[@index + 1..-1].each_byte do |b|
c = b.chr
- 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"