AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

File tetromino.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative 'block'

require 'matrix'

class Tetris
Severity: Minor
Found in samples/elaborate/tetris/model/tetromino.rb - About 2 hrs to fix

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

          def initialize(parent, *args, swt_transform: nil, multiply: false)
            Glimmer::SWT::DisplayProxy.instance.auto_exec do
              @parent = parent
              @multiply = multiply
              if swt_transform.nil?
    Severity: Minor
    Found in lib/glimmer/swt/transform_proxy.rb - About 2 hrs 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 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def handle_observation_request(observation_request, source_observation_request: nil, &block)
              if observation_request.to_s == 'on_shape_disposed'
                @on_shape_disposed_handlers ||= []
                @on_shape_disposed_handlers << block
                return ShapeListenerProxy.new(shape: self, drawable: drawable, shape_listener_block: block, observation_request: 'on_shape_disposed')
    Severity: Major
    Found in lib/glimmer/swt/custom/shape.rb - About 2 hrs to fix

      File hello_table.rb has 266 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'glimmer-dsl-swt'
      
      class HelloTable
        class BaseballGame
          class << self
      Severity: Minor
      Found in samples/hello/hello_table.rb - About 2 hrs to fix

        Method call has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def call(*args)
                options = args.last.is_a?(Hash) ? args.pop : {}
                internal_sort = options[:internal_sort] || false
                new_model_collection = args.first
                Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @model_binding.binding_options[:sync_exec], override_async_exec: @model_binding.binding_options[:async_exec]) do
        Severity: Major
        Found in lib/glimmer/data_binding/table_items_binding.rb - About 2 hrs to fix

          Class Polygon has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

                  class Polygon < Shape
                    def parameter_names
                      [:point_array]
                    end
                    
          Severity: Minor
          Found in lib/glimmer/swt/custom/shape/polygon.rb - About 2 hrs to fix

            Method for has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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 for has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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_gem has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    def custom_shell_gem(custom_shell_name, namespace)
                      gem_name = "glimmer-cs-#{compact_name(custom_shell_name)}"
                      gem_summary = "#{human_name(custom_shell_name)} - Glimmer Custom Shell"
                      begin
                        custom_shell_keyword = dsl_widget_name(custom_shell_name)
            Severity: Minor
            Found in lib/glimmer/rake_task/scaffold.rb - About 2 hrs 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 17 (exceeds 5 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 2 hrs 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 delegate_observation_request_to_checkboxes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    def delegate_observation_request_to_checkboxes(observation_request, &block)
                      if observation_request != 'on_widget_disposed'
                        checkboxes.count.times do |index|
                          checkbox = checkboxes[index]
                          label = labels[index]
            Severity: Minor
            Found in lib/glimmer/swt/custom/checkbox_group.rb - About 2 hrs 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 configure_sorting has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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 56 lines of code (exceeds 25 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: Major
            Found in lib/glimmer/rake_task/scaffold.rb - About 2 hrs to fix

              Method pagination has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def pagination
                        composite {
                          layout_data(:fill, :center, true, false)
                          
                          fill_layout(:horizontal) {
              Severity: Major
              Found in lib/glimmer/swt/custom/refined_table.rb - About 2 hrs to fix

                Class BaseballGame has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class BaseballGame
                    class << self
                      attr_accessor :selected_game
                      
                      def all_playoff_games
                Severity: Minor
                Found in samples/hello/hello_table.rb - About 2 hrs to fix

                  Class Polyline has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                          class Polyline < Shape
                            def parameter_names
                              [:point_array]
                            end
                            
                  Severity: Minor
                  Found in lib/glimmer/swt/custom/shape/polyline.rb - About 2 hrs to fix

                    Method all_playoff_games has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def all_playoff_games
                            @all_playoff_games ||= {
                              'NLDS' => [
                                new(Time.new(2037, 10, 6, 12, 0),  'Chicago Cubs', 'Milwaukee Brewers', 'Free Bobblehead'),
                                new(Time.new(2037, 10, 7, 12, 0),  'Chicago Cubs', 'Milwaukee Brewers'),
                    Severity: Major
                    Found in samples/hello/hello_table.rb - About 2 hrs to fix

                      Method games has a Cognitive Complexity of 16 (exceeds 5 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 2 hrs 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 edit_tree_item has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def edit_tree_item(tree_item, before_write: nil, after_write: nil, after_cancel: nil)
                              return if tree_item.nil?
                              content {
                                @tree_editor_text_proxy = text {
                                  focus true
                      Severity: Minor
                      Found in lib/glimmer/swt/tree_proxy.rb - About 1 hr to fix

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

                              def initialize(*args, swt_widget: nil)
                                auto_exec do
                                  if swt_widget
                                    @swt_widget = swt_widget
                                  else
                        Severity: Minor
                        Found in lib/glimmer/swt/shell_proxy.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language