deepcerulean/minotaur

View on GitHub

Showing 20 of 20 total issues

Method to_a has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

      def to_a
        # puts "--- serializing #{width}x#{height} grid to array!"
        #sleep 3
        output = []
        0.upto(height-1) do |y|
Severity: Minor
Found in lib/minotaur/serializers/array_serializer.rb - About 7 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

Class Region has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Region < Entity #< Struct.new(:location, :size)
    include Support::PositionHelpers
    include Support::DirectionHelpers
    attr_accessor :location, :size
    def_delegators :@size, :height, :width, :area
Severity: Minor
Found in lib/minotaur/geometry/region.rb - About 3 hrs to fix

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

        class Grid < Space
          include Support::PositionHelpers
          include Support::DirectionHelpers
    
          attr_accessor :rows
    Severity: Minor
    Found in lib/minotaur/geometry/grid.rb - About 2 hrs to fix

      Method cell has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

            def cell(pos,path)
              output = ""
              #pos = Position.new(x,y)
      
              output << if !path.empty? && adjacent_in_path?(pos,pos.translate(WEST),path)
      Severity: Minor
      Found in lib/minotaur/prettifiers/simple_prettifier.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 find_path has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def find_path(start, destination)
          # puts "=== finding path from #{start} to #{destination}!"
          distance = {}
          previous = {}
          visited = []
      Severity: Minor
      Found in lib/minotaur/pathfinders/dijkstras_pathfinder.rb - About 1 hr to fix

        Method build_space! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def build_space!(space)
                space.each_position do |position|
                  build_passage!(position,position.translate(WEST))  unless position.x <= space.location.x
                  build_passage!(position,position.translate(NORTH)) unless position.y <= space.location.y
                  build_passage!(position,position.translate(EAST))  unless position.x >= space.location.x + space.width - 1
        Severity: Minor
        Found in lib/minotaur/geometry/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 cell has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def cell(pos,path)
                output = ""
                #pos = Position.new(x,y)
        
                output << if !path.empty? && adjacent_in_path?(pos,pos.translate(WEST),path)
        Severity: Minor
        Found in lib/minotaur/prettifiers/simple_prettifier.rb - About 1 hr to fix

          Method carve_passageway! has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def carve_passageway!(room,other_room)
              direction = direction_between_rooms(room, other_room)
              case direction
              when NORTH then 
                x = adjacent_room_adjoining_edge(room, other_room).sample 
          Severity: Minor
          Found in lib/minotaur/extruders/assembling_room_extruder.rb - About 1 hr to fix

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

                  def serialized_value_for(pos)
                if stairs?(pos)
                  if stairs_up?(pos)
                    3
                  else
            Severity: Minor
            Found in lib/minotaur/serializers/compact_array_serializer.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 find_path has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                  def find_path(start, destination)
                # puts "=== finding path from #{start} to #{destination}!"
                distance = {}
                previous = {}
                visited = []
            Severity: Minor
            Found in lib/minotaur/pathfinders/dijkstras_pathfinder.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 recursively_place_adjacent_rooms has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def recursively_place_adjacent_rooms(source,depth=0)
                raise "first room not placed" unless source.placed
                return if depth <= -MAX_DEPTH
                unplaced_rooms.shuffle.take(2).each do |target|
                  next if target.placed
            Severity: Minor
            Found in lib/minotaur/extruders/assembling_room_extruder.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 diagonal_neighbors has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def diagonal_neighbors
                    arr = []
                    all_directions.map do |first_direction|
                      all_directions.map do |second_direction|
                        if first_direction != second_direction && first_direction != direction_opposite(second_direction)
            Severity: Minor
            Found in lib/minotaur/geometry/position.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 can_contain_adjacent_position? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def can_contain_adjacent_position?(room,other_room,direction)
                case direction
                when NORTH then (return false) if other_room.y - room.height <= 1
                when SOUTH then (return false) if other_room.y + room.height >= self.height - 1
                when EAST then  (return false) if other_room.x - room.width <= 1
            Severity: Minor
            Found in lib/minotaur/extruders/assembling_room_extruder.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_adjacent_to_room has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def place_adjacent_to_room(room, other_room, direction=nil) 
                proposed_location = nil
                proposed_direction = nil
                conflict = true
            
            
            Severity: Minor
            Found in lib/minotaur/extruders/assembling_room_extruder.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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def initialize(opts={})
                  if opts.include?(:x) && opts.include?(:y)
                self.location = Position.new(opts.delete(:x), opts.delete(:y))
                  elsif opts.include?(:location)
                self.location = opts.delete(:location) #{ origin }
            Severity: Minor
            Found in lib/minotaur/geometry/region.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 mutate! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def mutate!(arr)
                    return arr if arr.empty? || variance == 0
            
                    rounds.times do
                      arr.each do |one|
            Severity: Minor
            Found in lib/minotaur/geometry/mutator.rb - About 45 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 row_separator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def row_separator(y_coordinate,path)
                    output = ""
                    width.times do |x_coordinate|
                      pos = Position.new(x_coordinate,y_coordinate)
                      output << if passable?(pos,SOUTH)
            Severity: Minor
            Found in lib/minotaur/prettifiers/simple_prettifier.rb - About 45 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_first_room! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def place_first_room!
                first_room = self.rooms.sample
                if self.up_stairs_location
                  stairs << Stairwell.new(location: self.up_stairs_location, access: Stairwell::UP)
            
            
            Severity: Minor
            Found in lib/minotaur/extruders/assembling_room_extruder.rb - About 45 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 cell has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def cell(position)
                    output = ""
                    output << (passable?(position,SOUTH) ? " " : "_")
            
                    if self.rows[position.y][position.x] & EAST != 0
            Severity: Minor
            Found in lib/minotaur/prettifiers/compact_prettifier.rb - About 35 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 subdivide has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def subdivide(space,opts={})
                    depth = opts.delete(:depth) { 0 }
                    depth = depth + 1
                    return [space] if reached_size_limit?(space) || (recursive && depth > MAX_DEPTH)
            
            
            Severity: Minor
            Found in lib/minotaur/geometry/subdivider.rb - About 35 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

            Severity
            Category
            Status
            Source
            Language