Method include?
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def include? set
# setの変数に0を代入して計算
set_offset = set.calc 0
# その値がselfに含まれているか確認
input_string = set_offset < 0 ? "b" * (- set_offset) : "a" * set_offset
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def expand set
return self if self.include? set
return nil unless self.check_lank == 1 && set.check_lank == 0
set_offset = set.calc 0
if self.calc(-1) == set_offset
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def << term
new_elements = []
added_flag = false
@elements.each do |element|
if (element =~ term) && (not added_flag)
- 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"