Showing 9 of 9 total issues
Method rekey
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def rekey(key_map = nil, &block)
fail ArgumentError, "provide key_map, or block, not both" if key_map && block
# Note: self.dup is used to preserve the default_proc.
if key_map
- 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_re
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def to_re(opts = {})
if opts[:literal]
content = ::Regexp.escape(self)
- 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 camelcase
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def camelcase(*separators)
first_letter = separators.shift if ::Symbol === separators.first
separators = [/_+/, /\s+/] if separators.empty?
self.dup.tap do |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 deep_dup
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def deep_dup(obj = self)
return obj.deep_dup if obj != self && obj.respond_to?(:deep_dup)
case obj
when ::NilClass, ::FalseClass, ::TrueClass, ::Symbol, ::Numeric, ::Method
- 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 then_if
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def then_if(*conditions)
return self if conditions.empty? && !self
return self unless conditions.all? do |arg|
case arg
when ::Symbol then public_send(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 define_refine
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.define_refine(target)
target.send(:define_method, :refine) do |klass, &block|
fail TypeError, "wrong argument type #{klass.class} (expected Class)" unless klass.is_a? ::Class
fail ArgumentError, "no block given" unless block
- 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 many?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def many?
cnt = 0
if block_given?
any? do |element|
cnt += 1 if yield element
- 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 force_utf8!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def force_utf8!
str = force_encoding(Encoding::UTF_8)
if str.respond_to? :scrub!
str.scrub!
- 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 color
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def color(opts)
opts = {text: opts} unless opts.is_a? ::Hash
opts[:fg] ||= opts[:text] || opts[:color]
opts[:bg] ||= opts[:background]
- 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"