Method check
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def check(o_sprites, d_sprites, shot = :shot, hit = :hit)
res = false
o_sprites = [o_sprites].flatten.select { |s| s.is_a?(self) }
d_sprites = [d_sprites].flatten.select { |s| s.is_a?(self) }
discards = []
- 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 check
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check(o_sprites, d_sprites, shot = :shot, hit = :hit)
res = false
o_sprites = [o_sprites].flatten.select { |s| s.is_a?(self) }
d_sprites = [d_sprites].flatten.select { |s| s.is_a?(self) }
discards = []
Method draw
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def draw
if !@visible || vanished?
return
end
[:blend, :shader].each do |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 draw
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def draw
if !@visible || vanished?
return
end
[:blend, :shader].each do |method|
Consider simplifying this complex logical expression. Open
if !@collision_enable || vanished? ||
!other.collision_enable || other.vanished? ||
!other.image && !other.collision
return false
end
Method clean
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def clean(sprites)
sprites.size.times do |i|
s = sprites[i]
if s.kind_of?(Array)
clean(s)
- 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 !@collision_enable || vanished? ||
!other.collision_enable || other.vanished? ||
!other.image && !other.collision
return false
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(sprites)
[sprites].flatten.each do |s|
if !s.respond_to?(:vanished?) or !s.vanished?
if s.respond_to?(:update)
s.update
- 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 draw
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def draw(sprites)
[sprites].flatten.each do |s|
if !s.respond_to?(:vanished?) or !s.vanished?
if s.respond_to?(:draw)
s.draw
- 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"