AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 401 of 401 total issues

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

            time: {
              widget_value_property: :date_time,
              editor_gui: lambda do |args, model, property, table_proxy|
                first_time = true
                table_proxy.table_editor.minimumHeight = 25
Severity: Major
Found in lib/glimmer/swt/table_proxy.rb and 2 other locations - About 1 hr to fix
lib/glimmer/swt/table_proxy.rb on lines 135..154
lib/glimmer/swt/table_proxy.rb on lines 156..175

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 48.

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

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

            date: {
              widget_value_property: :date_time,
              editor_gui: lambda do |args, model, property, table_proxy|
                first_time = true
                table_proxy.table_editor.minimumHeight = 25
Severity: Major
Found in lib/glimmer/swt/table_proxy.rb and 2 other locations - About 1 hr to fix
lib/glimmer/swt/table_proxy.rb on lines 156..175
lib/glimmer/swt/table_proxy.rb on lines 177..196

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 48.

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

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

            date_drop_down: {
              widget_value_property: :date_time,
              editor_gui: lambda do |args, model, property, table_proxy|
                first_time = true
                table_proxy.table_editor.minimumHeight = 25
Severity: Major
Found in lib/glimmer/swt/table_proxy.rb and 2 other locations - About 1 hr to fix
lib/glimmer/swt/table_proxy.rb on lines 135..154
lib/glimmer/swt/table_proxy.rb on lines 177..196

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 48.

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

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

        def can_interpret?(parent, keyword, *args, &block)
          keyword == 'selection' and
            block.nil? and
            (parent.is_a?(Glimmer::SWT::Custom::CheckboxGroup) or (parent.is_a?(Glimmer::UI::CustomWidget) and parent.body_root.is_a?(Glimmer::SWT::Custom::CheckboxGroup)) ) and
            args.size == 1 and
lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb on lines 32..39

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 48.

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

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

        def can_interpret?(parent, keyword, *args, &block)
          keyword == 'selection' and
            block.nil? and
            (parent.is_a?(Glimmer::SWT::Custom::RadioGroup) or (parent.is_a?(Glimmer::UI::CustomWidget) and parent.body_root.is_a?(Glimmer::SWT::Custom::RadioGroup)) ) and
            args.size == 1 and
lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb on lines 32..39

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 48.

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

Consider simplifying this complex logical expression.
Open

        if override_sync_exec || override_sync_exec.nil? && !override_async_exec && sync_exec_required? && Config.auto_sync_exec? && !sync_exec_in_progress? && !async_exec_in_progress?
          sync_exec(&block)
        elsif override_async_exec || override_async_exec.to_s == 'unless_in_progress' && !async_exec_in_progress?
          async_exec(&block)
        else
Severity: Major
Found in lib/glimmer/swt/display_proxy.rb - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

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

      Consider simplifying this complex logical expression.
      Open

                return @args if parent.is_a?(Drawable) && !default_x? && !default_y? && !default_width? && !default_height? && !max_width? && !max_height?
      Severity: Major
      Found in lib/glimmer/swt/custom/shape.rb - About 1 hr to fix

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

            elsif [@game.snake.head.orientation, key] == [:north, swt(:arrow_left)] ||
                  [@game.snake.head.orientation, key] == [:west, swt(:arrow_down)] ||
                  [@game.snake.head.orientation, key] == [:south, swt(:arrow_right)] ||
                  [@game.snake.head.orientation, key] == [:east, swt(:arrow_up)]
              @game.snake.turn_left
        Severity: Minor
        Found in samples/elaborate/snake.rb and 1 other location - About 1 hr to fix
        samples/elaborate/snake.rb on lines 89..99

        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 47.

        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

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

            if [@game.snake.head.orientation, key] == [:north, swt(:arrow_right)] ||
               [@game.snake.head.orientation, key] == [:east, swt(:arrow_down)] ||
               [@game.snake.head.orientation, key] == [:south, swt(:arrow_left)] ||
               [@game.snake.head.orientation, key] == [:west, swt(:arrow_up)]
              @game.snake.turn_right
        Severity: Minor
        Found in samples/elaborate/snake.rb and 1 other location - About 1 hr to fix
        samples/elaborate/snake.rb on lines 94..98

        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 47.

        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

        Method parking_spot has a Cognitive Complexity of 9 (exceeds 5 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 55 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 place_ship! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def place_ship!(ship)
                begin
                  old_ship_top_left_cell = ship.top_left_cell
                  old_ship_orientation = ship.orientation
                  ship.top_left_cell = self
        Severity: Minor
        Found in samples/elaborate/battleship/model/cell.rb - About 55 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 start_event_loop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def start_event_loop
                auto_exec do
                  until @swt_widget.isDisposed
                    begin
                      @display.sleep unless @display.readAndDispatch
        Severity: Minor
        Found in lib/glimmer/swt/shell_proxy.rb - About 55 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 dispose has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                  def dispose(dispose_images: true, dispose_patterns: true, redraw: true)
                    Glimmer::SWT::DisplayProxy.instance.auto_exec do
                      # including classes could override to dispose of resources first
                      # afterwards, parent removes from its path segments with post_dispose_content
                      parent.post_dispose_content(self) if parent.is_a?(Path)
        Severity: Minor
        Found in lib/glimmer/swt/custom/shape/path_segment.rb - About 55 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_to_swt_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                  def add_to_swt_path(swt_path)
                    the_path_segment_args = path_segment_args.dup
                    the_path_segment_args = the_path_segment_args.first if the_path_segment_args.size == 1 && the_path_segment_args.first.is_a?(Array)
                    if !is_a?(Point) && self.class != Path
                      if !previous_point_connected?
        Severity: Minor
        Found in lib/glimmer/swt/custom/shape/path_segment.rb - About 55 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 default_width has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                def default_width
                  default_width_dependencies = [shapes.empty? && max_width, shapes.size == 1 && shapes.first.max_width? && parent.size.x, shapes.size >= 1 && !shapes.first.max_width? && shapes.map {|s| s.max_width? ? 0 : s.x_end}]
                  if default_width_dependencies != @default_width_dependencies
                    # Do not repeat calculations
                    max_width, parent_size_x, x_ends = @default_width_dependencies = default_width_dependencies
        Severity: Minor
        Found in lib/glimmer/swt/custom/shape.rb - About 55 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 default_height has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                def default_height
                  default_height_dependencies = [shapes.empty? && max_height, shapes.size == 1 && shapes.first.max_height? && parent.size.y, shapes.size >= 1 && !shapes.first.max_height? && shapes.map {|s| s.max_height? ? 0 : s.y_end}]
                  if default_height_dependencies != @default_height_dependencies
                    # Do not repeat calculations
                    max_height, parent_size_y, y_ends = @default_height_dependencies = default_height_dependencies
        Severity: Minor
        Found in lib/glimmer/swt/custom/shape.rb - About 55 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

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

            animation {
              every 0.25 # in seconds (one quarter)
              cycle colors # cycles array of colors into the second variable of the frame block below
        
              frame { |index, color| # frame block loops indefinitely (unless frame_count or cycle_count is set to an integer)
        Severity: Minor
        Found in samples/hello/hello_canvas_animation_multi.rb and 1 other location - About 50 mins to fix
        samples/hello/hello_canvas_animation_multi.rb on lines 77..91

        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 43.

        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

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

            animation {
              every 0.25 # in seconds (one quarter)
              cycle colors # cycles array of colors into the second variable of the frame block below
        
              frame { |index, color| # frame block loops indefinitely (unless frame_count or cycle_count is set to an integer)
        Severity: Minor
        Found in samples/hello/hello_canvas_animation_multi.rb and 1 other location - About 50 mins to fix
        samples/hello/hello_canvas_animation_multi.rb on lines 52..66

        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 43.

        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

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

        module Glimmer
          module DSL
            module SWT
              class TabItemExpression < StaticExpression
                include ParentExpression
        Severity: Minor
        Found in lib/glimmer/dsl/swt/tab_item_expression.rb and 1 other location - About 50 mins to fix
        lib/glimmer/dsl/swt/c_tab_item_expression.rb on lines 28..49

        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 43.

        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