AndyObtiva/glimmer-dsl-libui

View on GitHub
lib/glimmer/libui/control_proxy/area_proxy.rb

Summary

Maintainability
C
1 day
Test Coverage

Method install_listeners has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
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)
Severity: Minor
Found in lib/glimmer/libui/control_proxy/area_proxy.rb - About 7 hrs to fix

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

        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)
Severity: Major
Found in lib/glimmer/libui/control_proxy/area_proxy.rb - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    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})
                      ) &&
                      (
    Severity: Critical
    Found in lib/glimmer/libui/control_proxy/area_proxy.rb - About 1 hr to fix

      Method post_add_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      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
      Severity: Minor
      Found in lib/glimmer/libui/control_proxy/area_proxy.rb - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status