AndyObtiva/glimmer-dsl-libui

View on GitHub

Showing 156 of 312 total issues

Method data_bind_read has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def data_bind_read(property, model_binding)
          if model_binding.binding_options[:column_attributes].is_a?(Array)
            @column_attributes = model_binding.binding_options[:column_attributes]
          else
            column_attribute_mapping = model_binding.binding_options[:column_attributes].is_a?(Hash) ? model_binding.binding_options[:column_attributes] : {}
Severity: Minor
Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 2 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 for has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def for(keyword)
          unless flyweight_custom_control_classes.keys.include?(keyword)
            begin
              extracted_namespaces = keyword.
                to_s.
Severity: Minor
Found in lib/glimmer/libui/custom_control.rb - About 2 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 for has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

        def for(keyword)
          unless flyweight_custom_shape_classes.keys.include?(keyword)
            begin
              extracted_namespaces = keyword.
                to_s.
Severity: Minor
Found in lib/glimmer/libui/custom_shape.rb - About 2 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

File basic_table_selection2.rb has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'glimmer-dsl-libui'

class BasicTableSelection
  TableColumnPresenter = Struct.new(:name,
                                    :column,
Severity: Minor
Found in examples/basic_table_selection2.rb - About 2 hrs to fix

    File basic_table_selection.rb has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'glimmer-dsl-libui'
    
    class BasicTableSelection
      TableColumnPresenter = Struct.new(:name,
                                        :column,
    Severity: Minor
    Found in examples/basic_table_selection.rb - About 2 hrs to fix

      Method last_cell_row_for has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

              def last_cell_row_for(row)
                # TODO refactor to share code with cell_row_for
                @cached_last_cell_rows ||= []
                if @cached_last_cell_rows[row].nil?
                  last_cell_rows = @last_cell_rows || []
      Severity: Minor
      Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 2 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 last_last_cell_row_for has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

              def last_last_cell_row_for(row)
                # TODO refactor to share code with cell_row_for
                @cached_last_last_cell_rows ||= []
                if @cached_last_last_cell_rows[row].nil?
                  last_last_cell_rows = @last_last_cell_rows || []
      Severity: Minor
      Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 2 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 cell_row_for has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

              def cell_row_for(row)
                @cached_cell_rows ||= []
                if @cached_cell_rows[row].nil?
                  cell_rows = self.cell_rows || []
                  if cell_rows.is_a?(Enumerator)
      Severity: Minor
      Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 2 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 custom_window_gem has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

              def custom_window_gem(custom_window_name, namespace)
                gem_name = "glimmer-libui-cw-#{custom_window_name.underscore}"
                gem_summary = "#{human_name(custom_window_name)} - Glimmer Custom Window"
                begin
                  custom_window_keyword = dsl_control_name(custom_window_name)
      Severity: Minor
      Found in lib/glimmer/rake_task/scaffold.rb - About 2 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 handle_listener has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

              def handle_listener(listener_name, &listener)
                # if content has been added, then you can register listeners immediately (without accumulation)
                if CUSTOM_LISTENER_NAMES.include?(listener_name) || @content_added
                  actual_listener = listener
                  case listener_name
      Severity: Minor
      Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 2 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 launch has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def launch
          window('Dynamic Area', 240, 600) {
            margined true
            
            vertical_box {
      Severity: Major
      Found in examples/dynamic_area3.rb - About 2 hrs to fix

        Method draw has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def draw(area_draw_params)
                @start = ::LibUI.attributed_string_len(@parent_proxy.attributed_string)
                ::LibUI.attributed_string_append_unattributed(@parent_proxy.attributed_string, @string)
                unless color.nil?
                  color_attribute = ::LibUI.new_color_attribute(@color[:r].to_f / 255.0, @color[:g].to_f / 255.0, @color[:b].to_f / 255.0, @color[:a] || 1.0)
        Severity: Major
        Found in lib/glimmer/libui/attributed_string.rb - About 2 hrs to fix

          Method table_paginator has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def table_paginator
                    horizontal_box {
                      stretchy false
                      
                      button('<<') {
          Severity: Major
          Found in lib/glimmer/libui/custom_control/refined_table.rb - About 2 hrs to fix

            Method common_app has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def common_app(app_name, window_type = :app, window_options = {})
                      gem_name = file_name(app_name)
                      gem_summary = human_name(app_name)
                      return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
            #           system "ruby -S gem install bundler --no-document" if OS.windows? # resolves freezing issue with warbler and bundler 2.2.29 included in JRuby
            Severity: Minor
            Found in lib/glimmer/rake_task/scaffold.rb - About 2 hrs to fix

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

                def launch
                  window('Dynamic Area', 240, 600) {
                    margined true
                    
                    vertical_box {
              Severity: Minor
              Found in examples/dynamic_area.rb - About 2 hrs to fix

                Method register_cell_rows_observer has 50 lines of code (exceeds 25 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 2 hrs to fix

                  Method create_gui has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def create_gui
                      window('Timer') {
                        margined true
                        
                        group('Countdown') {
                  Severity: Minor
                  Found in examples/timer2.rb - About 1 hr to fix

                    Method build_control has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def build_control
                              unless area_image? # image object
                                if file
                                  load_image
                                  ImagePartProxy.new('image_part', self, [@data, width, height, width * 4])
                    Severity: Minor
                    Found in lib/glimmer/libui/control_proxy/image_proxy.rb - About 1 hr 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 calculate_shapes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def calculate_shapes
                              @shapes = []
                              original_pixels = @pixels.dup
                              indexed_original_pixels = Hash[original_pixels.each_with_index.to_a]
                              x_offset = x
                    Severity: Minor
                    Found in lib/glimmer/libui/control_proxy/image_proxy.rb - About 1 hr 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 draw has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def draw(area_draw_params)
                              children.each do |child|
                                child_fill = child.fill
                                child_stroke = child.stroke
                                child_transform = child.transform
                    Severity: Minor
                    Found in lib/glimmer/libui/shape/composite_shape.rb - About 1 hr 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

                    Severity
                    Category
                    Status
                    Source
                    Language