AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

Method handle_observation_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_observation_request(observation_request, &block)
        observation_request = observation_request.to_s
        if observation_request.start_with?('on_updated_')
          property = observation_request.sub(/^on_updated_/, '') # TODO look into eliminating duplication from above
          add_observer(DataBinding::Observer.proc(&block), property) if can_add_observer?(property)
Severity: Minor
Found in lib/glimmer/ui/custom_widget.rb - About 25 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_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def add_content(parent, keyword, *args, &block)
          # TODO consider avoiding source_location
          return if block&.parameters&.count == 2
          if block.source_location == parent.content&.__getobj__.source_location
            parent.content.call(parent) unless parent.content.called?
Severity: Minor
Found in lib/glimmer/dsl/swt/custom_shape_expression.rb - About 25 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 custom_shell has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def custom_shell(custom_shell_name, namespace, shell_type = nil, shell_options = {})
          namespace ||= current_dir_name
          root_dir = File.exists?('app') ? 'app' : 'lib'
          parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
          return puts("The file '#{parent_dir}/#{file_name(custom_shell_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_shell_name)}.rb")
Severity: Minor
Found in lib/glimmer/rake_task/scaffold.rb - About 25 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 regenerate has a Cognitive Complexity of 6 (exceeds 5 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 25 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_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def add_content(parent, keyword, *args, &block)
          # TODO consider avoiding source_location
          return if block&.parameters&.count == 2
          if block.source_location == parent.content&.__getobj__&.source_location
            parent.content.call(parent) unless parent.content.called?
Severity: Minor
Found in lib/glimmer/dsl/swt/custom_widget_expression.rb - About 25 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 custom_widget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def custom_widget(custom_widget_name, namespace)
          namespace ||= current_dir_name
          root_dir = File.exists?('app') ? 'app' : 'lib'
          parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
          return puts("The file '#{parent_dir}/#{file_name(custom_widget_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_widget_name)}.rb")
Severity: Minor
Found in lib/glimmer/rake_task/scaffold.rb - About 25 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 deconstruct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def deconstruct(integer)
          constant_source_class.constants.reduce([]) do |found, c|
            constant_value = constant_source_class.const_get(c) rescue -1
            is_found = constant_value.is_a?(Integer) && (integer & constant_value) == constant_value
            is_found ? found += [c] : found
Severity: Minor
Found in lib/glimmer/swt/style_constantizable.rb - About 25 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def create(*init_args, swt_widget: nil)
          DisplayProxy.instance.auto_exec do
            return swt_widget.get_data('proxy') if swt_widget&.get_data('proxy')
            keyword, parent, args = init_args
            selected_widget_proxy_class = widget_proxy_class(keyword || underscored_widget_name(swt_widget))
Severity: Minor
Found in lib/glimmer/swt/widget_proxy.rb - About 25 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 reverse_lookup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def reverse_lookup(integer)
          # TODO support looking up compound style mixes
          constant_source_class.constants.reduce([]) do |found, c|
            constant_value = constant_source_class.const_get(c) rescue -1
            is_found = constant_value.is_a?(Integer) && integer == constant_value
Severity: Minor
Found in lib/glimmer/swt/style_constantizable.rb - About 25 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 tetris_icon has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def tetris_icon
    icon_block_size = 64
    icon_bevel_size = icon_block_size.to_f / 25.to_f
    icon_bevel_pixel_size = 0.16*icon_block_size.to_f
    icon_size = 8
Severity: Minor
Found in samples/elaborate/tetris.rb - About 25 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(underscored_widget_name, parent, args)
        @no_sort = args.delete(:no_sort)
        super
        on_widget_selected do |event|
          parent.sort_by_column!(self) unless no_sort?
Severity: Minor
Found in lib/glimmer/swt/table_column_proxy.rb - About 25 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 cells has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def cells(for_orientation = nil)
        for_orientation ||= orientation
        if top_left_cell
          length.times.map do |index|
            if for_orientation == :horizontal
Severity: Minor
Found in samples/elaborate/battleship/model/ship.rb - About 25 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 move has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def move
        @old_tail = tail.dup
        @new_head = head.dup
        case @new_head.orientation
        when :east
Severity: Minor
Found in samples/elaborate/snake/model/snake.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

        def execute
          self.result = last_result.nil? || !last_command.is_a?(Number) ? '0.' : "#{last_result}."
          if operation.nil? || last_command.is_a?(Equals)
            self.number1 = self.result
            self.number2 = nil
Severity: Minor
Found in samples/elaborate/calculator/model/command/point.rb - About 25 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 build_mandelbrot_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def build_mandelbrot_image(mandelbrot_zoom: nil)
    mandelbrot_zoom ||= zoom
    unless flyweight_mandelbrot_images.keys.include?(mandelbrot_zoom)
      the_mandelbrot = mandelbrot(mandelbrot_zoom: mandelbrot_zoom)
      width = the_mandelbrot.width
Severity: Minor
Found in samples/elaborate/mandelbrot_fractal.rb - About 25 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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def method_missing(method_name, *args, &block)
        result = Glimmer::SWT::DisplayProxy.instance.auto_exec { @swt_transform.send(method_name, *args, &block) }
        result.nil? ? self : result
      rescue => e
        begin
Severity: Minor
Found in lib/glimmer/swt/transform_proxy.rb - About 25 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 change_cursor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def change_cursor
        if type == :grid && model.ship && !Cell.dragging?
          body_root.cursor = model.ship.orientation == :horizontal ? :sizens : :sizewe
        elsif !Cell.dragging?
          body_root.cursor = :arrow
Severity: Minor
Found in samples/elaborate/battleship/view/cell.rb - About 25 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 property_type_converters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def property_type_converters
        color_converter = lambda do |value|
          if value.is_a?(Symbol) || value.is_a?(String)
            ColorProxy.new(value).swt_color
          elsif value.is_a?(RGB)
Severity: Minor
Found in lib/glimmer/swt/widget_proxy.rb - About 25 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(game = Model::Game.new)
        @game = game
        @cells = @game.height.times.map do |row|
          @game.width.times.map do |column|
            Cell.new(grid: self, row: row, column: column)
Severity: Minor
Found in samples/elaborate/snake/presenter/grid.rb - About 25 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 custom_shape has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def custom_shape(custom_shape_name, namespace)
          namespace ||= current_dir_name
          root_dir = File.exists?('app') ? 'app' : 'lib'
          parent_dir = "#{root_dir}/#{file_name(namespace)}/view"
          return puts("The file '#{parent_dir}/#{file_name(custom_shape_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_shape_name)}.rb")
Severity: Minor
Found in lib/glimmer/rake_task/scaffold.rb - About 25 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