Method handle_event
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def handle_event(gosu_id, action) #:nodoc:
@window.close if @auto_quit && gosu_id == @auto_quit
if action == :down
@down_ids[gosu_id] = true
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 handle_event
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_event(gosu_id, action) #:nodoc:
@window.close if @auto_quit && gosu_id == @auto_quit
if action == :down
@down_ids[gosu_id] = true
else
Method fire_event
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def fire_event(event)
fire :event_received, event
# fix for pause bug?
@hooks ||= {}
- 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 _register_hook
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _register_hook(listener, event_class, *event_ids, &block)
return unless block_given?
@hooks[event_class] ||= {}
for event_id in event_ids
@uses_mouse = true if event_id >= MsRangeBegin && event_id <= MsRangeEnd
- 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 unregister_hook
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def unregister_hook(event_class, *event_ids, &block)
event_class = :down if DOWN_EVENTS.include? event_class
event_class = :up if UP_EVENTS.include? event_class
@hooks[event_class] ||= {}
for event_id in event_ids
- 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 register
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def register(game)
@window.when :button_up do |button_id|
handle_event button_id, :up
end
@window.when :button_down do |button_id|
- 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 clear_hooks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def clear_hooks(listener=nil)
if listener
for event_klass, id_listeners in @hooks
for key in id_listeners.keys.dup
id_listeners[key].delete_if do |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"