AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 401 of 401 total issues

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

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

                  def initialize(widget, property, sync_exec: nil, async_exec: nil)
                    @widget = widget
                    @property = property
                    @sync_exec = sync_exec
                    @async_exec = async_exec
            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 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 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 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  def evaluate_horizontal_win
                    connections = nil
                    last_slot_value = nil
                    HEIGHT.times do |row_index|
                      connections = nil
            Severity: Major
            Found in samples/elaborate/connect4/model/grid.rb and 1 other location - About 1 hr to fix
            samples/elaborate/connect4/model/grid.rb on lines 104..122

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 64.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language