AndyObtiva/glimmer-dsl-libui

View on GitHub

Showing 156 of 312 total issues

Method launch has a Cognitive Complexity of 122 (exceeds 5 allowed). Consider refactoring.
Open

  def launch
    window('Area-Based Custom Controls', 385, 385) { |w|
      margined true
      
      tab {
Severity: Minor
Found in examples/area_based_custom_controls.rb - About 2 days 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 build_control has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
Open

        def build_control
          @model_handler = ::LibUI::FFI::TableModelHandler.malloc
          @model_handler.NumColumns   = fiddle_closure_block_caller(4) { @columns.map {|c| c.is_a?(DualColumn) ? 2 : (c.is_a?(TripleColumn) ? 3 : 1)}.sum }
          @model_handler.ColumnType   = fiddle_closure_block_caller(4, [1, 1, 4]) do |_, _, column|
            # TODO consider refactoring to use Glimmer::LibUI.enum_symbols(:table_value_type)
Severity: Minor
Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 1 day 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

File scaffold.rb has 631 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'fileutils'
require 'os'
require 'facets/string/titlecase'

# TODO refactor to nest under RakeTask namespace
Severity: Major
Found in lib/glimmer/rake_task/scaffold.rb - About 1 day to fix

    File table_proxy.rb has 612 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'glimmer/libui/control_proxy'
    require 'glimmer/libui/control_proxy/dual_column'
    require 'glimmer/libui/control_proxy/triple_column'
    require 'glimmer/data_binding/observer'
    require 'glimmer/fiddle_consumer'
    Severity: Major
    Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 1 day to fix

      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 setup_timer has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

        def setup_timer
          unless @setup_timer
            Glimmer::LibUI.timer(1) do
              if @started
                seconds = @sec_spinbox.value
      Severity: Minor
      Found in examples/timer2.rb - About 6 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 setup_timer has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

        def setup_timer
          unless @setup_timer
            Glimmer::LibUI.timer(1) do
              if @started
                seconds = @sec
      Severity: Minor
      Found in examples/timer.rb - About 6 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

      Class TableProxy has 47 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class TableProxy < ControlProxy
              include Glimmer::FiddleConsumer
              
              CUSTOM_LISTENER_NAMES = ['on_changed', 'on_edited']
              DEFAULT_COLUMN_SORT_BLOCK = lambda do |table_cell_row, column, table_proxy|
      Severity: Minor
      Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 6 hrs to fix

        Class ControlProxy has 46 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class ControlProxy
              class << self
                def exists?(keyword)
                  ::LibUI.respond_to?("new_#{keyword}") or
                    ::LibUI.respond_to?(keyword) or
        Severity: Minor
        Found in lib/glimmer/libui/control_proxy.rb - About 6 hrs to fix

          Method launch has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

            def launch
              window('Meta-Example', 1000, 500) {
                margined true
                
                horizontal_box {
          Severity: Minor
          Found in examples/meta_example.rb - About 5 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 register_cell_rows_observer has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

                  def register_cell_rows_observer
                    # TODO update all the each_with_index calls below to work differently when value is an Enumerator
                    # Perhaps, call ::LibUI.table_model_row_inserted(model, row) not from here, yet from the place where
                    # we call `next` on the Enumerator to grab more elements
                    # There will need to be extra intelligence for figuring out when to delete instead of
          Severity: Minor
          Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 5 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

          Class Shape has 40 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class Shape
                class << self
                  def exists?(keyword)
                    keyword = KEYWORD_ALIASES[keyword] || keyword
                    Shape.constants.include?(constant_symbol(keyword)) and
          Severity: Minor
          Found in lib/glimmer/libui/shape.rb - About 5 hrs to fix

            Method custom_window_file has 131 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def custom_window_file(custom_window_name, namespace, window_type, window_options = {})
                      window_options ||= {}
                      window_options[:custom_window_class_name] ||= 'CustomWindow'
                      namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
                
            Severity: Major
            Found in lib/glimmer/rake_task/scaffold.rb - About 5 hrs to fix

              Method build_control has 127 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def build_control
                        @model_handler = ::LibUI::FFI::TableModelHandler.malloc
                        @model_handler.NumColumns   = fiddle_closure_block_caller(4) { @columns.map {|c| c.is_a?(DualColumn) ? 2 : (c.is_a?(TripleColumn) ? 3 : 1)}.sum }
                        @model_handler.ColumnType   = fiddle_closure_block_caller(4, [1, 1, 4]) do |_, _, column|
                          # TODO consider refactoring to use Glimmer::LibUI.enum_symbols(:table_value_type)
              Severity: Major
              Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 5 hrs to fix

                Method launch has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def launch
                    window('Area-Based Custom Controls', 385, 385) { |w|
                      margined true
                      
                      tab {
                Severity: Major
                Found in examples/area_based_custom_controls.rb - About 5 hrs to fix

                  Class Game has 34 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class Game
                        PLAYFIELD_WIDTH = 10
                        PLAYFIELD_HEIGHT = 20
                        PREVIEW_PLAYFIELD_WIDTH = 4
                        PREVIEW_PLAYFIELD_HEIGHT = 2
                  Severity: Minor
                  Found in examples/tetris/model/game.rb - About 4 hrs to fix

                    File control_proxy.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'glimmer/libui/data_bindable'
                    
                    module Glimmer
                      module LibUI
                        # Proxy for LibUI control objects
                    Severity: Minor
                    Found in lib/glimmer/libui/control_proxy.rb - About 4 hrs to fix

                      Method launch has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def launch
                          window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
                            margined true
                            
                            vertical_box {
                      Severity: Major
                      Found in examples/custom_draw_text2.rb - About 3 hrs to fix

                        Method launch has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def launch
                            window('Meta-Example', 1000, 500) {
                              margined true
                              
                              horizontal_box {
                        Severity: Major
                        Found in examples/meta_example.rb - About 3 hrs to fix

                          Method launch has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def launch
                              menu('Actions') {
                                menu_item('Restart') {
                                  on_clicked do
                                    restart_game
                          Severity: Major
                          Found in examples/color_the_circles.rb - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language