Showing 5 of 7 total issues
Method bowl
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def bowl(canvas = $stdout, pins: [], power: nil, hook: nil, delay: 0.1)
i = 1
while i <= @distance do
angle = (hook - 50).abs
- 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 run
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
print cursor.hide
puts cursor.clear_screen
pos = Position[(cols / 3) - 10, rows / 5]
Method bowl
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bowl(canvas = $stdout, pins: [], power: nil, hook: nil, delay: 0.1)
i = 1
while i <= @distance do
angle = (hook - 50).abs
Method roll
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def roll(pins)
return if finish?
current_frame_scores << pins
@total += pins
- 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 second_roll
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def second_roll(frame)
scores = @score.frames[frame]
if scores.nil?
" "
elsif strike?(frame)
- 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"