lib/glimmer/libui/control_proxy/area_proxy.rb
Method install_listeners
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
Open
def install_listeners
unless @listeners_installed
@area_handler.Draw = fiddle_closure_block_caller(0, [1, 1, 1]) do |_, _, area_draw_params|
area_draw_params = ::LibUI::FFI::AreaDrawParams.new(area_draw_params)
area_draw_params = area_draw_params_hash(area_draw_params)
- 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 install_listeners
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def install_listeners
unless @listeners_installed
@area_handler.Draw = fiddle_closure_block_caller(0, [1, 1, 1]) do |_, _, area_draw_params|
area_draw_params = ::LibUI::FFI::AreaDrawParams.new(area_draw_params)
area_draw_params = area_draw_params_hash(area_draw_params)
Consider simplifying this complex logical expression. Open
Open
if ((
handle_custom_listener('on_key_event').empty? ||
(handle_custom_listener('on_key_event').any? && on_key_event_results.all? {|result| LibUI.boolean_to_integer(result) == 0})
) &&
(
Method post_add_content
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def post_add_content
if OS.linux? && parent_proxy.is_a?(WindowProxy)
unless @content_added
original_parent_proxy = @parent_proxy
@vertical_box_parent_proxy = ControlProxy.create('vertical_box', parent_proxy, []) {} # block prevents calling post add content
- 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"