Showing 5 of 5 total issues
Method colors_from_hash
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def colors_from_hash(match, hash)
if self.class.prevent_colors
match[0] ||= mode(hash[:mode]) if mode(hash[:mode])
match[1] ||= color(hash[:color]) if color(hash[:color])
match[2] ||= background_color(hash[:background]) if background_color(hash[: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"
Further reading
Method parse_color_alias_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_color_alias_params(params)
return [params] if params.is_a?(Array) && params.length == 2
params.flat_map do |param|
next param if param.is_a?(Array) && param.length == 2
- 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 enable_readline_support
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enable_readline_support(value = nil)
if value.nil?
if defined?(@@readline_support)
@@readline_support || false
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 disable_colorization
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def disable_colorization(value = nil)
if value.nil?
if defined?(@@disable_colorization)
@@disable_colorization || false
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 prevent_colors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prevent_colors(value = nil)
if value.nil?
if defined?(@@prevent_colors)
@@prevent_colors || false
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"