AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

Method method_missing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def method_missing(method, *args, &block)
        if has_attribute_setter?(method, *args)
          set_attribute(method, *args)
        elsif has_attribute_getter?(method, *args)
          get_attribute(method, *args)
Severity: Minor
Found in lib/glimmer/swt/proxy_properties.rb - About 35 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 get_attribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

      def auto_exec(override_sync_exec: nil, override_async_exec: nil, &block)
        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)
Severity: Minor
Found in lib/glimmer/swt/display_proxy.rb - About 35 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 remote_tutorials has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def remote_tutorials
      if @remote_tutorials.nil?
        remote_tutorials_response = Net::HTTP.get_response(URI(URL_TUTORIALS))
        raise "Error downloading remote tutorial list from #{URL_TUTORIALS} (defaulting to local list): HTTP status #{remote_tutorials_response.code} #{remote_tutorials_response.message}!" unless remote_tutorials_response.code.to_i.between?(200, 299)
        remote_tutorials_yaml = remote_tutorials_response.body
Severity: Minor
Found in samples/elaborate/meta_sample.rb - About 35 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 sample_directories has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sample_directories
      if @sample_directories.nil?
        @sample_directories = Dir.glob(File.join(File.expand_path('..', __FILE__), '*')).
            select { |file| File.directory?(file) }.
            map { |file| SampleDirectory.new(file) }
Severity: Minor
Found in samples/elaborate/meta_sample.rb - About 35 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 beat_container has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def beat_container
    composite {
      grid_layout(@rhythm.beat_count, true)
      
      @rhythm.beat_count.times { |n|
Severity: Minor
Found in samples/elaborate/metronome.rb - About 35 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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def execute
          self.result = last_result.nil? || (!last_command.is_a?(Number) && !last_command.is_a?(Point)) ? button : last_result + button
          if operation.nil? || last_command.is_a?(Equals)
            self.number1 = self.result
            self.number2 = nil
Severity: Minor
Found in samples/elaborate/calculator/model/command/number.rb - About 35 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 can_handle_drop_observation_request? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def can_handle_drop_observation_request?(observation_request)
        auto_exec do
          return false unless swt_widget.is_a?(Control)
          potential_drop_target = @drop_target_proxy.nil?
          ensure_drop_target_proxy
Severity: Minor
Found in lib/glimmer/swt/widget_proxy.rb - About 35 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 handle_observation_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_observation_request(observation_request, &block)
        observation_request = normalize_observation_request(observation_request)
        if observation_request.start_with?('on_drag_enter')
          original_block = block
          block = Proc.new do |event|
Severity: Minor
Found in lib/glimmer/swt/widget_proxy.rb - About 35 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 add_listener has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_listener(underscored_listener_name, &block)
        auto_exec do
          widget_add_listener_method, listener_class, listener_method = self.class.find_listener(@swt_widget.getClass, underscored_listener_name)
          widget_listener_proxy = nil
          safe_block = lambda do |*args|
Severity: Minor
Found in lib/glimmer/swt/widget_proxy.rb - About 35 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 calculate_points has a Cognitive Complexity of 7 (exceeds 5 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 35 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 extract_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def extract_args(underscored_widget_name, args)
        @arg_extractor_mapping ||= {
          'menu_item' => lambda do |args|
            index = args.delete(args.last) if args.last.is_a?(Numeric)
            extra_options = [index].compact
Severity: Minor
Found in lib/glimmer/swt/widget_proxy.rb - About 35 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 populate_table has a Cognitive Complexity of 7 (exceeds 5 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 35 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 drag_source= has a Cognitive Complexity of 7 (exceeds 5 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 35 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 calculated_args_changed_for_defaults! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def calculated_args_changed_for_defaults!
          has_default_dimensions = default_width? || default_height?
          parent_calculated_args_changed_for_defaults = has_default_dimensions
          calculated_args_changed!(children: false) if default_x? || default_y? || has_default_dimensions
          if has_default_dimensions && parent.is_a?(Shape)
Severity: Minor
Found in lib/glimmer/swt/custom/shape.rb - About 35 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 hex_color_to_swt_color has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def hex_color_to_swt_color(color_data, default_color)
          color_data = "##{color_data.chars.drop(1).map {|c| c*2}.join}" if color_data.is_a?(String) && color_data.start_with?('#') && color_data&.size == 4
          color_data = color_data.match(REGEX_COLOR_HEX6).to_a.drop(1).map {|c| "0x#{c}".hex}.to_a if color_data.is_a?(String) && color_data.start_with?('#')
          color_data = [color_data] unless color_data.nil? || color_data.empty? || color_data.is_a?(Array)
          color_data = default_color if color_data.nil? || color_data.empty?
Severity: Minor
Found in lib/glimmer/swt/custom/code_text.rb - About 35 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 calculate_args! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def calculate_args!
            new_swt_path = @swt_path.nil? || !@calculated_paint_args || !@calculated_path_args
            if new_swt_path
              Glimmer::SWT::DisplayProxy.instance.auto_exec do
                @swt_path&.dispose
Severity: Minor
Found in lib/glimmer/swt/custom/shape/path.rb - About 35 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 display_tasks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def display_tasks
      if OS.windows? || Launcher.is_arm64?
        require 'rake'
        Rake::TaskManager.record_task_metadata = true
        require_relative 'rake_task'
Severity: Minor
Found in lib/glimmer/launcher.rb - About 35 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 clear_shapes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def clear_shapes(dispose_images: true, dispose_patterns: true, redraw: :all)
          if redraw == true || redraw == :all
            shapes.dup.each {|shape| shape.dispose(dispose_images: dispose_images, dispose_patterns: dispose_patterns, redraw: false) }
            drawable.redraw if redraw && !drawable.is_a?(ImageProxy)
          elsif redraw == :each
Severity: Minor
Found in lib/glimmer/swt/custom/shape.rb - About 35 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 drag_and_move= has a Cognitive Complexity of 7 (exceeds 5 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 35 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