deepcerulean/minotaur

View on GitHub
lib/minotaur/extruders/assembling_room_extruder.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

    There are no issues that match your filters.

    Category
    Status