AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

Method custom_widget_gem has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def custom_widget_gem(custom_widget_name, namespace)
          gem_name = "glimmer-cw-#{compact_name(custom_widget_name)}"
          gem_summary = "#{human_name(custom_widget_name)} - Glimmer Custom Widget"
          if namespace
            gem_name += "-#{compact_name(namespace)}"
Severity: Minor
Found in lib/glimmer/rake_task/scaffold.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 custom_shape_gem has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def custom_shape_gem(custom_shape_name, namespace)
          gem_name = "glimmer-cp-#{compact_name(custom_shape_name)}"
          gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
          if namespace
            gem_name += "-#{compact_name(namespace)}"
Severity: Minor
Found in lib/glimmer/rake_task/scaffold.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 ensure_extent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def ensure_extent(paint_event)
          old_extent = @extent
          old_extent_args = @extent_args
          if ['text', 'string'].include?(@name)
            extent_args = [string]
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 apply_shape_arg_defaults! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def apply_shape_arg_defaults!
          if current_parameter_name?(:dest_x) && dest_x.nil?
            self.dest_x = :default
          elsif parameter_name?(:x) && x.nil?
            self.x = :default
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 initialize has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def initialize(*args, &content)
        @args = args
        @parent_proxy = nil
        if @args.first.is_a?(WidgetProxy)
          @parent_proxy = @args.shift
Severity: Minor
Found in lib/glimmer/swt/image_proxy.rb - About 1 hr to fix

    Method parking_spot has 36 lines of code (exceeds 25 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 1 hr to fix

      Method default_blocks has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def default_blocks
              case @letter
              when :I
                [
                  [block, block, block, block]
      Severity: Minor
      Found in samples/elaborate/tetris/model/tetromino.rb - About 1 hr to fix

        Method find_listener has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.find_listener(swt_widget_class, underscored_listener_name)
                @listeners ||= {}
                listener_key = [swt_widget_class.name, underscored_listener_name]
                unless @listeners.has_key?(listener_key)
                  listener_method_name = underscored_listener_name.camelcase(:lower)
        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

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

              def set_attribute(attribute_name, *args)
                # TODO consider refactoring/unifying this code with WidgetProxy and elsewhere
                if args.count == 1
                  if args.first.is_a?(Symbol) || args.first.is_a?(String)
                    args[0] = ColorProxy.new(args.first).swt_color
        Severity: Minor
        Found in lib/glimmer/swt/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 [] has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

                def [](*symbols)
                  symbols = symbols.first if symbols.size == 1 && symbols.first.is_a?(Array)
                  result = symbols.compact.map do |symbol|
                    constant(symbol).tap do |constant_value|
                      raise Glimmer::Error, symbol.to_s + error_message_invalid_style unless constant_value.is_a?(Integer)
        Severity: Minor
        Found in lib/glimmer/swt/style_constantizable.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 swt_widget_class_for has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def self.swt_widget_class_for(underscored_widget_name)
                # TODO clear memoization for a keyword if a custom widget was defined with that keyword
                unless flyweight_swt_widget_classes.keys.include?(underscored_widget_name)
                  begin
                    underscored_widget_name = KEYWORD_ALIASES[underscored_widget_name] if KEYWORD_ALIASES[underscored_widget_name]
        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

        Method start_moving_tetrominos_down has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def start_moving_tetrominos_down
            Thread.new do
              @mutex.synchronize do
                loop do
                  time = Time.now
        Severity: Minor
        Found in samples/elaborate/tetris.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 custom_widget_gem has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def custom_widget_gem(custom_widget_name, namespace)
                  gem_name = "glimmer-cw-#{compact_name(custom_widget_name)}"
                  gem_summary = "#{human_name(custom_widget_name)} - Glimmer Custom Widget"
                  if namespace
                    gem_name += "-#{compact_name(namespace)}"
        Severity: Minor
        Found in lib/glimmer/rake_task/scaffold.rb - About 1 hr to fix

          Method custom_shape_gem has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def custom_shape_gem(custom_shape_name, namespace)
                    gem_name = "glimmer-cp-#{compact_name(custom_shape_name)}"
                    gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
                    if namespace
                      gem_name += "-#{compact_name(namespace)}"
          Severity: Minor
          Found in lib/glimmer/rake_task/scaffold.rb - About 1 hr to fix

            Method sort! has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def sort!(internal_sort: false)
                    return unless sort_property && (sort_type || sort_block || sort_by_block)
                    if sort_strategy
                      sort_strategy.call
                    else
            Severity: Minor
            Found in lib/glimmer/swt/table_proxy.rb - About 1 hr to fix

              Method build_radios has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def build_radios
                        current_selection = selection
                        @composites.to_a.each(&:dispose)
                        @radios = []
                        @labels = []
              Severity: Minor
              Found in lib/glimmer/swt/custom/radio_group.rb - About 1 hr to fix

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

                      def initialize(parent, args)
                        index = args.delete(args.last) if args.last.is_a?(Numeric)
                        styles = args.map(&:to_sym)
                        if !styles.include?(:bar) && !parent.swt_widget.is_a?(Menu)
                          styles = styles.unshift(:pop_up)
                Severity: Minor
                Found in lib/glimmer/swt/menu_proxy.rb - About 1 hr to fix

                  Method all has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def all
                          @all ||= [
                            {town: 'Chicago', name: 'White Sox', ballpark: 'Guaranteed Rate Field'},
                            {town: 'Cleveland', name: 'Indians', ballpark: 'Progressive Field'},
                            {town: 'Detroit', name: 'Tigers', ballpark: 'Comerica Park'},
                  Severity: Minor
                  Found in samples/hello/hello_refined_table.rb - About 1 hr to fix

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

                          def initialize(parent, *args, 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')
                            @args = args
                    Severity: Minor
                    Found in lib/glimmer/ui/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 orientation= has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def orientation=(value)
                            if top_left_cell
                              if value == :horizontal
                                if top_left_cell.column_index + length > Grid::WIDTH
                                  raise "Top left cell #{top_left_cell} cannot fit ship #{name}"
                    Severity: Minor
                    Found in samples/elaborate/battleship/model/ship.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