AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

Method set_attribute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def set_attribute(attribute_name, *args)
        swt_widget_operation = false
        result = nil
        Glimmer::SWT::DisplayProxy.instance.auto_exec do
          result = if proxy_source_object&.respond_to?(attribute_setter(attribute_name))
Severity: Minor
Found in lib/glimmer/swt/proxy_properties.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 interpret has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def interpret(parent, keyword, *args, &block)
          options = args.last.is_a?(Hash) ? args.last : {}
          coordinate_args = args.size == (options.empty? ? 2 : 3)
          args.unshift(parent) unless parent.nil? || options[:top_level]
          @create_pixel_by_pixel = coordinate_args && block&.parameters&.count == 2
Severity: Minor
Found in lib/glimmer/dsl/swt/image_expression.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 rotate! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def rotate!(direction)
        return if stopped?
        can_rotate = nil
        new_blocks = nil
        game.hypothetical do
Severity: Minor
Found in samples/elaborate/tetris/model/tetromino.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 method_missing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def method_missing(method_name, *args, &block)
          dsl_mode = @dsl_mode || args.last.is_a?(Hash) && args.last[:dsl]
          if dsl_mode
            args.pop if args.last.is_a?(Hash) && args.last[:dsl]
            super(method_name, *args, &block)
Severity: Minor
Found in lib/glimmer/swt/custom/code_text.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 config has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def config
          project_name = File.basename(File.expand_path('.'))
          if !File.exists?('config/warble.rb')
            puts 'Generating JAR configuration (config/warble.rb) to use with Warbler...'
            FileUtils.mkdir_p('config')
Severity: Minor
Found in lib/glimmer/rake_task/package.rb - About 1 hr to fix

    Method place_ship! has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def place_ship!(ship)
            begin
              old_ship_top_left_cell = ship.top_left_cell
              old_ship_orientation = ship.orientation
              ship.top_left_cell = self
    Severity: Minor
    Found in samples/elaborate/battleship/model/cell.rb - About 1 hr to fix

      Method populate_table has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def populate_table(model_collection, parent, column_properties, internal_sort: false)
              selected_table_item_models = parent.swt_widget.getSelection.map(&:get_data)
              parent.finish_edit!
              dispose_start_index = @last_model_collection_attribute_values &&
                                    (model_collection.count < @last_model_collection_attribute_values.count) &&
      Severity: Minor
      Found in lib/glimmer/data_binding/table_items_binding.rb - About 1 hr to fix

        Method calculate_paint_args! has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def calculate_paint_args!
                  unless @calculated_paint_args
                    if @name == 'pixel'
                      @name = 'point'
                      # optimized performance calculation for pixel points
        Severity: Minor
        Found in lib/glimmer/swt/custom/shape.rb - About 1 hr to fix

          Method delegate_observation_request_to_radios has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def delegate_observation_request_to_radios(observation_request, &block)
                    if observation_request != 'on_widget_disposed'
                      radios.count.times do |index|
                        radio = radios[index]
                        label = labels[index]
          Severity: Minor
          Found in lib/glimmer/swt/custom/radio_group.rb - About 1 hr to fix

            Method calculate_points has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def calculate_points
                puts "Background calculation activated at zoom #{zoom}" if @background
                if @points_calculated
                  puts "Points calculated already. Returning previously calculated points..."
                  return @points
            Severity: Minor
            Found in samples/elaborate/mandelbrot_fractal.rb - About 1 hr to fix

              Method countdown_group_button_composite has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def countdown_group_button_composite
                  composite {
                    row_layout {
                      margin_width 0
                      margin_height 0
              Severity: Minor
              Found in samples/elaborate/timer.rb - About 1 hr to fix

                Method enemy_attack! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def enemy_attack!
                        begin
                          cell = nil
                          if @enemy_moves.any? && @enemy_moves.last.hit? && !@enemy_moves.last.ship.sunk?
                            if @enemy_moves[-2].nil? || !@enemy_moves[-2].hit?
                Severity: Minor
                Found in samples/elaborate/battleship/model/game.rb - About 1 hr to fix

                  Method drag_source= has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def drag_source=(drag_source_value)
                            deregister_drag_listeners if @drag_and_move
                            drag_source_old_value = @drag_source
                            @drag_source = drag_source_value
                            if @drag_source && !drag_source_old_value
                  Severity: Minor
                  Found in lib/glimmer/swt/custom/shape.rb - About 1 hr to fix

                    Method apply_shape_arg_conversions! has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def apply_shape_arg_conversions!
                              if @args.size > 1 && (['polygon', 'polyline'].include?(@name))
                                @args[0] = @args.dup
                                @args[1..-1] = []
                              end
                    Severity: Minor
                    Found in lib/glimmer/swt/custom/shape.rb - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if override_sync_exec || override_sync_exec.nil? && !override_async_exec && sync_exec_required? && Config.auto_sync_exec? && !sync_exec_in_progress? && !async_exec_in_progress?
                                sync_exec(&block)
                              elsif override_async_exec || override_async_exec.to_s == 'unless_in_progress' && !async_exec_in_progress?
                                async_exec(&block)
                              else
                      Severity: Major
                      Found in lib/glimmer/swt/display_proxy.rb - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                  if stopped? or
                                      (start_number != @start_number) or
                                      (frame_count_limited? && @frame_index == @frame_count) or
                                      (cycle_limited? && @cycle_count_index == @cycle_count) or
                                      surpassed_duration_limit?
                        Severity: Major
                        Found in lib/glimmer/swt/custom/animation.rb - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                    return @args if parent.is_a?(Drawable) && !default_x? && !default_y? && !default_width? && !default_height? && !max_width? && !max_height?
                          Severity: Major
                          Found in lib/glimmer/swt/custom/shape.rb - About 1 hr to fix

                            Method parking_spot has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def parking_spot(location_x, location_y, length, angle)
                                parking_spot_letter = next_parking_spot_letter
                                height = length
                                width = (2.0/3)*length
                                
                            Severity: Minor
                            Found in samples/elaborate/parking.rb - About 55 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

                            Method place_ship! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def place_ship!(ship)
                                    begin
                                      old_ship_top_left_cell = ship.top_left_cell
                                      old_ship_orientation = ship.orientation
                                      ship.top_left_cell = self
                            Severity: Minor
                            Found in samples/elaborate/battleship/model/cell.rb - About 55 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

                            Method start_event_loop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def start_event_loop
                                    auto_exec do
                                      until @swt_widget.isDisposed
                                        begin
                                          @display.sleep unless @display.readAndDispatch
                            Severity: Minor
                            Found in lib/glimmer/swt/shell_proxy.rb - About 55 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

                            Severity
                            Category
                            Status
                            Source
                            Language