simplay/bofrev

View on GitHub

Showing 30 of 30 total issues

Class GameSettings has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

class GameSettings

  extend Singletonable
  include GameMetaData

Severity: Minor
Found in src/game_settings.rb - About 3 hrs to fix

    Class Grid has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Grid < Drawable
    
      include Enumerable
    
      # Build a new Grid of Dimension (width x height)
    Severity: Minor
    Found in src/grid.rb - About 2 hrs to fix

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

      class GameField < Drawable
      
        include Enumerable
        include RenderHelpers
        include GameFieldTypeConstants
      Severity: Minor
      Found in src/game_field.rb - About 2 hrs to fix

        Method update_grid has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def update_grid
            if @allow_updates
        
              @prev_iter_grid.inner_height_iter.each do |row_idx|
                @prev_iter_grid.inner_width_iter.each do |idx|
        Severity: Minor
        Found in demos/game_of_life/game_of_life_map.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

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

        class Tetris::ReverseLPiece < Tetris::Shape
        
          def initialize(map, color)
            super(map, color)
          end
        Severity: Major
        Found in demos/tetris/shapes/reverse_l_piece.rb and 5 other locations - About 2 hrs to fix
        demos/tetris/shapes/l_piece.rb on lines 4..16
        demos/tetris/shapes/line_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_squiggly.rb on lines 4..16
        demos/tetris/shapes/squiggly.rb on lines 4..16
        demos/tetris/shapes/t_block.rb on lines 4..16

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

        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 6 locations. Consider refactoring.
        Open

        class Tetris::LinePiece < Tetris::Shape
        
          def initialize(map, color)
            super(map, color)
          end
        Severity: Major
        Found in demos/tetris/shapes/line_piece.rb and 5 other locations - About 2 hrs to fix
        demos/tetris/shapes/l_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_l_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_squiggly.rb on lines 4..16
        demos/tetris/shapes/squiggly.rb on lines 4..16
        demos/tetris/shapes/t_block.rb on lines 4..16

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

        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 6 locations. Consider refactoring.
        Open

        class Tetris::TBlock < Tetris::Shape
        
          def initialize(map, color)
            super(map, color)
          end
        Severity: Major
        Found in demos/tetris/shapes/t_block.rb and 5 other locations - About 2 hrs to fix
        demos/tetris/shapes/l_piece.rb on lines 4..16
        demos/tetris/shapes/line_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_l_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_squiggly.rb on lines 4..16
        demos/tetris/shapes/squiggly.rb on lines 4..16

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

        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 6 locations. Consider refactoring.
        Open

        class Tetris::ReverseSquiggly < Tetris::Shape
        
          def initialize(map, color)
            super(map, color)
          end
        Severity: Major
        Found in demos/tetris/shapes/reverse_squiggly.rb and 5 other locations - About 2 hrs to fix
        demos/tetris/shapes/l_piece.rb on lines 4..16
        demos/tetris/shapes/line_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_l_piece.rb on lines 4..16
        demos/tetris/shapes/squiggly.rb on lines 4..16
        demos/tetris/shapes/t_block.rb on lines 4..16

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

        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 6 locations. Consider refactoring.
        Open

        class Tetris::LPiece < Tetris::Shape
        
          def initialize(map, color)
            super(map, color)
          end
        Severity: Major
        Found in demos/tetris/shapes/l_piece.rb and 5 other locations - About 2 hrs to fix
        demos/tetris/shapes/line_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_l_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_squiggly.rb on lines 4..16
        demos/tetris/shapes/squiggly.rb on lines 4..16
        demos/tetris/shapes/t_block.rb on lines 4..16

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

        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 6 locations. Consider refactoring.
        Open

        class Tetris::Squiggly < Tetris::Shape
        
          def initialize(map, color)
            super(map, color)
          end
        Severity: Major
        Found in demos/tetris/shapes/squiggly.rb and 5 other locations - About 2 hrs to fix
        demos/tetris/shapes/l_piece.rb on lines 4..16
        demos/tetris/shapes/line_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_l_piece.rb on lines 4..16
        demos/tetris/shapes/reverse_squiggly.rb on lines 4..16
        demos/tetris/shapes/t_block.rb on lines 4..16

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

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

          def update_grid
            if @allow_updates
        
              @prev_iter_grid.inner_height_iter.each do |row_idx|
                @prev_iter_grid.inner_width_iter.each do |idx|
        Severity: Minor
        Found in demos/game_of_life/game_of_life_map.rb - About 1 hr to fix

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

            def attach_listeners
              @main_frame.add_key_listener KeyListener.impl { |name, event|
                # key_debugger("KeyListener", name, event)
                value_pressed_key = key_pressed_for(event.getKeyChar)
                event_identifier = "#{name}_#{value_pressed_key}"
          Severity: Minor
          Found in src/view.rb - About 1 hr to fix

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

            class SnakeMetaData
              extend GameMetaData
            
              def self.theme_list
                []
            Severity: Major
            Found in demos/snake/snake_meta_data.rb and 1 other location - About 1 hr to fix
            demos/sokoban/sokoban_meta_data.rb on lines 5..50

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

            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

            class SokobanMetaData
              extend GameMetaData
            
              def self.theme_list
                []
            Severity: Major
            Found in demos/sokoban/sokoban_meta_data.rb and 1 other location - About 1 hr to fix
            demos/snake/snake_meta_data.rb on lines 5..50

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

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

              def draw_fractal_pixel_at(graphics, p_x, p_y, zoom_lvl)
                # transform pixel coordinates to normalized coordinates
                sq_zoom_lvl = Math.sqrt(zoom_lvl)
                zoomed_x_min = -2.5 / sq_zoom_lvl
                zoomed_x_max = 1.0 / sq_zoom_lvl
            Severity: Minor
            Found in demos/fractals/fractal.rb - About 1 hr to fix

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

                def initialize(shape, operation, shift = Point2f.new(0,0))
                  @state = :moveable
              
                  if operation == :rotate
                    next_rot_hit_points = shape.next_rotated_shape
              Severity: Minor
              Found in demos/tetris/collision_checker.rb - About 1 hr to fix

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

                  def initialize(shape, operation, shift = Point2f.new(0,0))
                    @state = :moveable
                
                    if operation == :rotate
                      next_rot_hit_points = shape.next_rotated_shape
                Severity: Minor
                Found in demos/tetris/collision_checker.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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def start
                    return nil unless @pacer.running?
                    @thread = Thread.new do
                      loop do
                        suspend if @game.paused?
                Severity: Minor
                Found in src/ticker.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 attach_listeners has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def attach_listeners
                    @main_frame.add_key_listener KeyListener.impl { |name, event|
                      # key_debugger("KeyListener", name, event)
                      value_pressed_key = key_pressed_for(event.getKeyChar)
                      event_identifier = "#{name}_#{value_pressed_key}"
                Severity: Minor
                Found in src/view.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

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

                    @main_frame.add_mouse_listener MouseListener.impl { |name, event|
                      # key_debugger("MouseListener", name, event)
                      offsets = GameSettings.canvas_offsets
                      x = event.getX-offsets[0]/2
                      y = event.getY-offsets[1]/2
                Severity: Minor
                Found in src/view.rb and 1 other location - About 55 mins to fix
                src/view.rb on lines 43..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 44.

                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