AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

Method inspect has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        def inspect(recursive: 1, calculated: false, args: true, properties: true, calculated_args: false)
          recurse = recursive == true || recursive.is_a?(Integer) && recursive.to_i > 0
          recursive = [recursive -= 1, 0].max if recursive.is_a?(Integer)
          args_string = " args=#{@args.inspect}" if args
          properties_string = " properties=#{@properties.inspect}}" if properties
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 launch has a Cognitive Complexity of 15 (exceeds 5 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

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 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def set_attribute(attribute_name, *args)
          options = args.last if args.last.is_a?(Hash)
          args.pop if !options.nil? && !options[:redraw].nil?
          options ||= {}
          perform_redraw = @perform_redraw
Severity: Minor
Found in lib/glimmer/swt/custom/shape.rb - About 1 hr to fix

    Method initialize has a Cognitive Complexity of 14 (exceeds 5 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

    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_color has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def swt_color
            unless @swt_color
              case @args.size
              when 1
                if @args.first.is_a?(String) || @args.first.is_a?(Symbol)
    Severity: Minor
    Found in lib/glimmer/swt/color_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 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize(underscored_layout_name, widget_proxy, args)
            DisplayProxy.instance.auto_exec do
              @underscored_layout_name = underscored_layout_name
              @widget_proxy = widget_proxy
              args = SWTProxy.constantify_args(args)
    Severity: Minor
    Found in lib/glimmer/swt/layout_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 top_left_cell= has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def top_left_cell=(a_cell)
            if a_cell
              raise "Top left cell #{a_cell} already occupied by ship #{a_cell.ship.name}" if a_cell.ship && a_cell.ship != self
              raise "Top left cell #{a_cell} cannot fit ship #{name}" if a_cell.column_index + length > Grid::WIDTH
              grid = ship_collection.game.grids[ship_collection.player]
    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

    Method build_checkboxes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

            def build_checkboxes
              current_selection = selection
              @composites.to_a.each(&:dispose)
              @checkboxes = []
              @labels = []
    Severity: Minor
    Found in lib/glimmer/swt/custom/checkbox_group.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 draw_frame has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method native has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def native(native_type=nil, native_extra_args)
                puts "Generating native executable with jpackage..."
                java_version = `jruby -v`
                if java_version.include?(JDK_VERSION)
                  puts "Java Version #{JDK_VERSION} Detected!"
      Severity: Minor
      Found in lib/glimmer/rake_task/package.rb - About 1 hr to fix

        Method sort_by_column! has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def sort_by_column!(table_column_proxy=nil)
                index = nil
                auto_exec do
                  index = swt_widget.columns.to_a.index(table_column_proxy.swt_widget) unless table_column_proxy.nil?
                end
        Severity: Minor
        Found in lib/glimmer/swt/table_proxy.rb - About 1 hr to fix

          Method timer_menu_bar has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def timer_menu_bar
              menu_bar {
                menu {
                  text '&Action'
                  
          Severity: Minor
          Found in samples/elaborate/timer.rb - About 1 hr to fix

            Method build_checkboxes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

                    def evaluate_diagonal_win(diagonal_coordinates)
                      connections = nil
                      last_slot_value = nil
                      diagonal_coordinates.each do |group|
                        connections = nil
              Severity: Minor
              Found in samples/elaborate/connect4/model/grid.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 evaluate_horizontal_win has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                    def evaluate_horizontal_win
                      connections = nil
                      last_slot_value = nil
                      HEIGHT.times do |row_index|
                        connections = nil
              Severity: Minor
              Found in samples/elaborate/connect4/model/grid.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 call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                    def call(value)
                      SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @sync_exec, override_async_exec: @async_exec) do
                        if @widget.respond_to?(:disposed?) && @widget.disposed?
                          unless @widget.shell_proxy.last_shell_closing?
                            @widget_proxy.widget_bindings.delete(self)
              Severity: Minor
              Found in lib/glimmer/data_binding/widget_binding.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 common_app has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                      def common_app(app_name, shell_type = :app, shell_options = {})
                        gem_name = file_name(app_name)
                        gem_summary = human_name(app_name)
                        return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
                        system "jruby -S gem install bundler --no-document" if OS.windows? # resolves freezing issue with warbler and bundler 2.2.29 included in JRuby
              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 evaluate_vertical_win has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                    def evaluate_vertical_win
                      connections = nil
                      last_slot_value = nil
                      WIDTH.times do |column_index|
                        connections = nil
              Severity: Minor
              Found in samples/elaborate/connect4/model/grid.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 normalized_attribute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                      def normalized_attribute(attribute_name)
                        @normalized_attributes ||= {}
                        if @normalized_attributes[attribute_name].nil?
                          attribute_name = attribute_name.to_s if attribute_name.is_a?(Symbol)
                          attribute_name = attribute_name.underscore unless attribute_name.downcase?
              Severity: Minor
              Found in lib/glimmer/swt/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

              Severity
              Category
              Status
              Source
              Language