AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

Method post_add_content has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def post_add_content
        shown = false
        unless @initialize_tabs_on_select
          @show_listener = parent_proxy.on_swt_show do
            unless shown
Severity: Minor
Found in lib/glimmer/swt/tab_folder_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 initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(parent, *swt_style_symbols, options, &content)
        SWT::DisplayProxy.current_custom_widgets_and_shapes << self
        @parent_proxy = @parent = parent
        @parent_proxy = @parent&.get_data('proxy') if @parent.respond_to?(:get_data) && @parent.get_data('proxy')
        @swt_style_symbols = swt_style_symbols
Severity: Minor
Found in lib/glimmer/ui/custom_widget.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 can_interpret? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def can_interpret?(parent, keyword, *args, &block)
          Glimmer::Config.logger.debug {"keyword starts with on_: #{keyword.start_with?('on_')}"}
          return false unless keyword.start_with?('on_')
          proper_parent = parent.respond_to?(:swt_widget) || parent.is_a?(Glimmer::SWT::DisplayProxy) || parent.is_a?(Glimmer::SWT::Custom::Shape) || parent.is_a?(Glimmer::UI::CustomShape)
          Glimmer::Config.logger.debug {"parent #{parent} is a widget, shape, or display: #{proper_parent}"}
Severity: Minor
Found in lib/glimmer/dsl/swt/listener_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 method_name has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

          def method_name(keyword, method_arg_options)
            keyword = keyword.to_s
            method_arg_options = method_arg_options.select {|key, value| %w[fill gradient round].include?(key.to_s)}
            unless flyweight_method_names.keys.include?([keyword, method_arg_options])
              gradient = 'Gradient' if method_arg_options[:gradient]
Severity: Minor
Found in lib/glimmer/swt/custom/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

Method regenerate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def regenerate
    @thread = Thread.new do
      @button.enabled = false
      @path1.clear
      @path2.clear
Severity: Minor
Found in samples/hello/hello_canvas_path.rb - About 1 hr to fix

    Method print has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def print(gc=nil, job_name: nil)
            if gc.is_a?(org.eclipse.swt.graphics.GC)
              @swt_widget.print(gc)
            else
              image = Image.new(DisplayProxy.instance.swt_display, bounds)
    Severity: Minor
    Found in lib/glimmer/swt/widget_proxy.rb - About 1 hr to fix

      Method initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def initialize(*init_args, swt_widget: nil)
              auto_exec do
                @image_double_buffered = !!(init_args&.last&.include?(:image_double_buffered) && init_args&.last&.delete(:image_double_buffered))
                if swt_widget.nil?
                  underscored_widget_name, parent, args = init_args
      Severity: Minor
      Found in lib/glimmer/swt/widget_proxy.rb - About 1 hr to fix

        Method setup_shape_painting has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def setup_shape_painting
                  # TODO consider performance optimization relating to order of shape rendering (affecting only further shapes not previous ones)
                  if @paint_listener_proxy.nil?
                    shape_painter = lambda do |paint_event|
                      shape_painting_work = lambda do |paint_event|
        Severity: Minor
        Found in lib/glimmer/swt/custom/drawable.rb - About 1 hr to fix

          Method position_options has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def position_options
                [
                  'CEO',
                  'CFO',
                  'CIO',
          Severity: Minor
          Found in samples/hello/hello_tree.rb - About 1 hr to fix

            Method countdown_group_field_composite has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Method configure_sorting has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def configure_sorting
                        @table_proxy.sort_strategy = lambda do
                          new_sort = @table_proxy.sort_block || @table_proxy.sort_by_block || @table_proxy.sort_property
                          new_sort_direction = @table_proxy.sort_direction
                          return if new_sort == @last_sort && new_sort_direction == @last_sort_direction
              Severity: Minor
              Found in lib/glimmer/swt/custom/refined_table.rb - About 1 hr to fix

                Method same_table_data? has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def same_table_data?(new_model_collection)
                        (["text"] + TABLE_ITEM_PROPERTIES).all? do |table_item_property|
                          table_cells = @table.swt_widget.items.map do |item|
                            model = item.get_data
                            @table.column_properties.each_with_index.map do |column_property, i|
                Severity: Minor
                Found in lib/glimmer/data_binding/table_items_binding.rb - About 1 hr to fix

                  Method for has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def for(underscored_custom_shape_name)
                            unless flyweight_custom_shape_classes.keys.include?(underscored_custom_shape_name)
                              begin
                                extracted_namespaces = underscored_custom_shape_name.
                                  to_s.
                  Severity: Minor
                  Found in lib/glimmer/ui/custom_shape.rb - About 1 hr to fix

                    Method for has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def for(underscored_custom_widget_name)
                              unless flyweight_custom_widget_classes.keys.include?(underscored_custom_widget_name)
                                begin
                                  extracted_namespaces = underscored_custom_widget_name.
                                    to_s.
                    Severity: Minor
                    Found in lib/glimmer/ui/custom_widget.rb - About 1 hr to fix

                      Method paint_self has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              def paint_self(paint_event)
                                @painting = true
                                unless container?
                                  calculate_paint_args!
                                  @original_gc_properties = {} # this stores GC properties before making calls to updates TODO avoid using in pixel graphics
                      Severity: Minor
                      Found in lib/glimmer/swt/custom/shape.rb - About 1 hr to fix

                        Method paint_pixel_by_pixel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                def paint_pixel_by_pixel(width = nil, height = nil, &each_pixel_color)
                                  if @image_double_buffered
                                    work = lambda do |paint_event|
                                      width ||= swt_drawable.bounds.width
                                      height ||= swt_drawable.bounds.height
                        Severity: Minor
                        Found in lib/glimmer/swt/custom/drawable.rb - About 1 hr to fix

                          Method games has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def games
                                if @games.nil?
                                  @games = []
                                  baseball_team_combinations = BaseballTeam.all.combination(2).to_a
                                  current_day = first_day
                          Severity: Minor
                          Found in samples/hello/hello_refined_table.rb - About 1 hr to fix

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

                                  def launch(application, jruby_options: [], env_vars: {}, glimmer_options: {})
                                    jruby_options_string = jruby_options.join(' ') + ' ' if jruby_options.any?
                                    env_vars = env_vars.merge(glimmer_option_env_vars(glimmer_options))
                                    env_vars.each do |k,v|
                                      ENV[k] = v
                            Severity: Minor
                            Found in lib/glimmer/launcher.rb - About 1 hr to fix

                              Method drag_and_move= has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

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

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

                                      def can_handle_drag_observation_request?(observation_request)
                                        auto_exec do
                                          return false unless swt_widget.is_a?(Control)
                                          potential_drag_source = @drag_source_proxy.nil?
                                          ensure_drag_source_proxy
                                Severity: Minor
                                Found in lib/glimmer/swt/widget_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

                                Severity
                                Category
                                Status
                                Source
                                Language