Mirroar/hivemind

View on GitHub
src/room/planner/variation-builder.ts

Summary

Maintainability
F
1 wk
Test Coverage

File variation-builder.ts has 637 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import hivemind from 'hivemind';
import minCut from 'utils/mincut';
import PlaceTowersStep from 'room/planner/step/place-towers';
import RoomVariationBuilderBase from 'room/planner/variation-builder-base';
import settings from 'settings-manager';
Severity: Major
Found in src/room/planner/variation-builder.ts - About 1 day to fix

    RoomVariationBuilder has 34 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class RoomVariationBuilder extends RoomVariationBuilderBase {
        exitCenters: ExitCoords;
        roomCenter: RoomPosition;
        roomCenterEntrances: RoomPosition[];
        protected sourceInfo: Record<string, {
    Severity: Minor
    Found in src/room/planner/variation-builder.ts - About 4 hrs to fix

      Function findBayPosition has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          findBayPosition(): RoomPosition {
              let maxExtensions = 0;
              let bestPos = null;
              let bestScore = 0;
      
      
      Severity: Minor
      Found in src/room/planner/variation-builder.ts - About 4 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

      Function placeRamparts has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          placeRamparts(): StepResult {
              // Make sure the controller can't directly be reached by enemies.
              const roomIntel = getRoomIntel(this.roomName);
              const safety = roomIntel.calculateAdjacentRoomSafety();
      
      
      Severity: Minor
      Found in src/room/planner/variation-builder.ts - About 3 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

      Function placeLabs has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          placeLabs() {
              this.placementManager.startBuildingPlacement();
              while (this.roomPlan.canPlaceMore('lab')) {
                  const nextPos = this.placementManager.getNextAvailableBuildSpot();
                  if (!nextPos) return 'failed';
      Severity: Minor
      Found in src/room/planner/variation-builder.ts - 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

      Function getRampartGroups has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          getRampartGroups(): RoomPosition[][] {
              const allRamparts = _.map(this.roomPlan.getPositions('rampart'), pos => ({
                  pos,
                  isUsed: false,
              }));
      Severity: Minor
      Found in src/room/planner/variation-builder.ts - 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

      Function placeDecorativeWalls has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          placeDecorativeWalls(): StepResult {
              const patternHeight = decorativeWallPattern.length;
              const patternWidth = decorativeWallPattern[0].length;
      
              for (let x = 1; x < 49; x++) {
      Severity: Minor
      Found in src/room/planner/variation-builder.ts - 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

      Function pruneWalls has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          pruneWalls(walls: RoomPosition[]) {
              const roomIntel = getRoomIntel(this.roomName);
              const safety = roomIntel.calculateAdjacentRoomSafety();
              const roomCenter = _.first(this.roomPlan.getPositions('center'));
              this.safetyMatrix = new PathFinder.CostMatrix();
      Severity: Minor
      Found in src/room/planner/variation-builder.ts - 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

      Function placeRoadsToRamps has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          placeRoadsToRamps(): StepResult {
              for (const rampartGroup of this.getRampartGroups()) {
                  const roads = this.placementManager.findAccessRoad(this.roomCenterEntrances[0], rampartGroup, true);
      
                  for (const road of roads) {
      Severity: Minor
      Found in src/room/planner/variation-builder.ts - 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

      Function placeLabs has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          placeLabs() {
              this.placementManager.startBuildingPlacement();
              while (this.roomPlan.canPlaceMore('lab')) {
                  const nextPos = this.placementManager.getNextAvailableBuildSpot();
                  if (!nextPos) return 'failed';
      Severity: Minor
      Found in src/room/planner/variation-builder.ts - About 1 hr to fix

        Function pruneWalls has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            pruneWalls(walls: RoomPosition[]) {
                const roomIntel = getRoomIntel(this.roomName);
                const safety = roomIntel.calculateAdjacentRoomSafety();
                const roomCenter = _.first(this.roomPlan.getPositions('center'));
                this.safetyMatrix = new PathFinder.CostMatrix();
        Severity: Minor
        Found in src/room/planner/variation-builder.ts - About 1 hr to fix

          Function sealRoom has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              sealRoom(): StepResult {
                  for (let x = 1; x < 49; x++) {
                      for (let y = 1; y < 49; y++) {
                          if (this.terrain.get(x, y) === TERRAIN_MASK_WALL) {
                              this.placementManager.blockPosition(x, y);
          Severity: Minor
          Found in src/room/planner/variation-builder.ts - 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

          Function placeRamparts has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              placeRamparts(): StepResult {
                  // Make sure the controller can't directly be reached by enemies.
                  const roomIntel = getRoomIntel(this.roomName);
                  const safety = roomIntel.calculateAdjacentRoomSafety();
          
          
          Severity: Minor
          Found in src/room/planner/variation-builder.ts - About 1 hr to fix

            Function placeQuadBreaker has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                placeQuadBreaker(): StepResult {
                    for (const rampart of this.roomPlan.getPositions('rampart')) {
                        handleMapArea(rampart.x, rampart.y, (x, y) => {
                            if (this.safetyMatrix.get(x, y) !== TILE_IS_UNSAFE) return;
                            if (this.terrain.get(x, y) === TERRAIN_MASK_WALL) return;
            Severity: Minor
            Found in src/room/planner/variation-builder.ts - About 1 hr to fix

              Function findBayPosition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  findBayPosition(): RoomPosition {
                      let maxExtensions = 0;
                      let bestPos = null;
                      let bestScore = 0;
              
              
              Severity: Minor
              Found in src/room/planner/variation-builder.ts - About 1 hr to fix

                Function getRampartGroups has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    getRampartGroups(): RoomPosition[][] {
                        const allRamparts = _.map(this.roomPlan.getPositions('rampart'), pos => ({
                            pos,
                            isUsed: false,
                        }));
                Severity: Minor
                Found in src/room/planner/variation-builder.ts - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (currentRampart.getRangeTo(otherRampart) !== 1) continue;
                  Severity: Major
                  Found in src/room/planner/variation-builder.ts - About 45 mins to fix

                    Function pruneWallFromTiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        pruneWallFromTiles(walls: RoomPosition[], startLocations: string[], onlyRelevant?: boolean) {
                            const openList = {};
                            const closedList = {};
                            let safetyValue = TILE_IS_SAFE;
                    
                    
                    Severity: Minor
                    Found in src/room/planner/variation-builder.ts - 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

                    Function canFitLabStamp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        canFitLabStamp(pos: RoomPosition, dx: number, dy: number, availableTiles: number[][]): boolean {
                            // This stamp can fit 1 more lab than necessary.
                            //  ooo
                            // oo.o
                            // o.oo
                    Severity: Minor
                    Found in src/room/planner/variation-builder.ts - 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

                    Avoid too many return statements within this function.
                    Open

                            return freeTiles > 8;
                    Severity: Major
                    Found in src/room/planner/variation-builder.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      if (this.roomPlan.hasPosition('road', pos)) return;
                      Severity: Major
                      Found in src/room/planner/variation-builder.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        if (!nearRoad && (x + y) % 2 === 0) return;
                        Severity: Major
                        Found in src/room/planner/variation-builder.ts - About 30 mins to fix

                          Function placeHarvestBayStructures has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              placeHarvestBayStructures(): StepResult {
                                  const roomIntel = getRoomIntel(this.roomName);
                                  for (const source of roomIntel.getSourcePositions()) {
                                      const shouldAddSpawn = this.variationInfo.sourcesWithSpawn.includes(source.id);
                                      const harvestPosition = this.sourceInfo[source.id].harvestPosition;
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts - About 25 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

                          Function placeRoadNetwork has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              placeRoadNetwork(): StepResult {
                                  // Find paths from each exit towards the room center for making roads.
                                  for (const dir of _.keys(this.exitCenters)) {
                                      for (const pos of this.exitCenters[dir]) {
                                          const exitRoads = this.placementManager.findAccessRoad(pos, this.roomCenterEntrances);
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts - About 25 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

                                          if (
                                              this.roomPlan.hasPosition('road', new RoomPosition(x - 1, y, this.roomName))
                                              && !this.roomPlan.hasPosition('road.rampart', new RoomPosition(x - 1, y, this.roomName))
                                          ) nearRoad = true;
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 1 hr to fix
                          src/room/planner/variation-builder.ts on lines 890..893

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

                          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 (
                                              this.roomPlan.hasPosition('road', new RoomPosition(x + 1, y, this.roomName))
                                              && !this.roomPlan.hasPosition('road.rampart', new RoomPosition(x + 1, y, this.roomName))
                                          ) nearRoad = true;
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 1 hr to fix
                          src/room/planner/variation-builder.ts on lines 886..889

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

                          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 (
                                              this.roomPlan.hasPosition('road', new RoomPosition(x, y + 1, this.roomName))
                                              && !this.roomPlan.hasPosition('road.rampart', new RoomPosition(x, y + 1, this.roomName))
                                          ) nearRoad = true;
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 1 hr to fix
                          src/room/planner/variation-builder.ts on lines 894..897

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

                          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 (
                                              this.roomPlan.hasPosition('road', new RoomPosition(x, y - 1, this.roomName))
                                              && !this.roomPlan.hasPosition('road.rampart', new RoomPosition(x, y - 1, this.roomName))
                                          ) nearRoad = true;
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 1 hr to fix
                          src/room/planner/variation-builder.ts on lines 898..901

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

                          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 (this.terrain.get(0, i) !== TERRAIN_MASK_WALL && !safety.directions.W) {
                                          exits.push(encodePosition(new RoomPosition(0, i, this.roomName)));
                                      }
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 1 hr to fix
                          src/room/planner/variation-builder.ts on lines 625..627

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

                          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 (this.terrain.get(49, i) !== TERRAIN_MASK_WALL && !safety.directions.E) {
                                          exits.push(encodePosition(new RoomPosition(49, i, this.roomName)));
                                      }
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 1 hr to fix
                          src/room/planner/variation-builder.ts on lines 621..623

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

                          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 (this.terrain.get(i, 0) !== TERRAIN_MASK_WALL && !safety.directions.N) {
                                          exits.push(encodePosition(new RoomPosition(i, 0, this.roomName)));
                                      }
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 1 hr to fix
                          src/room/planner/variation-builder.ts on lines 633..635

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

                          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 (this.terrain.get(i, 49) !== TERRAIN_MASK_WALL && !safety.directions.S) {
                                          exits.push(encodePosition(new RoomPosition(i, 49, this.roomName)));
                                      }
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 1 hr to fix
                          src/room/planner/variation-builder.ts on lines 629..631

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

                          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

                                  for (const source of roomIntel.getSourcePositions()) {
                                      openList.push(encodePosition(new RoomPosition(source.x, source.y, this.roomName)));
                                  }
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 55 mins to fix
                          src/room/planner/variation-builder.ts on lines 609..611

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

                          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

                                  for (const mineral of roomIntel.getMineralPositions()) {
                                      openList.push(encodePosition(new RoomPosition(mineral.x, mineral.y, this.roomName)));
                                  }
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 55 mins to fix
                          src/room/planner/variation-builder.ts on lines 605..607

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x - 1, this.roomCenter.y - 1, this.roomName), 'road', 1);
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 2 other locations - About 50 mins to fix
                          src/room/planner/variation-builder.ts on lines 345..345
                          src/room/planner/variation-builder.ts on lines 346..346

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x + 1, this.roomCenter.y - 1, this.roomName), 'road', 1);
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 2 other locations - About 50 mins to fix
                          src/room/planner/variation-builder.ts on lines 344..344
                          src/room/planner/variation-builder.ts on lines 345..345

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x - 1, this.roomCenter.y + 1, this.roomName), 'road', 1);
                          Severity: Major
                          Found in src/room/planner/variation-builder.ts and 2 other locations - About 50 mins to fix
                          src/room/planner/variation-builder.ts on lines 344..344
                          src/room/planner/variation-builder.ts on lines 346..346

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x, this.roomCenter.y + 2, this.roomName), 'road', 1);
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 35 mins to fix
                          src/room/planner/variation-builder.ts on lines 342..342

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x, this.roomCenter.y - 2, this.roomName), 'road', 1);
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 35 mins to fix
                          src/room/planner/variation-builder.ts on lines 343..343

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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x - 1, this.roomCenter.y, this.roomName), 'link');
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 2 other locations - About 35 mins to fix
                          src/room/planner/variation-builder.ts on lines 352..352
                          src/room/planner/variation-builder.ts on lines 354..354

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x - 1, this.roomCenter.y, this.roomName), 'link.storage');
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 2 other locations - About 35 mins to fix
                          src/room/planner/variation-builder.ts on lines 352..352
                          src/room/planner/variation-builder.ts on lines 353..353

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x + 1, this.roomCenter.y, this.roomName), 'factory');
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 2 other locations - About 35 mins to fix
                          src/room/planner/variation-builder.ts on lines 353..353
                          src/room/planner/variation-builder.ts on lines 354..354

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x - 2, this.roomCenter.y, this.roomName), 'road', 1);
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 35 mins to fix
                          src/room/planner/variation-builder.ts on lines 341..341

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x + 2, this.roomCenter.y, this.roomName), 'road', 1);
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 35 mins to fix
                          src/room/planner/variation-builder.ts on lines 340..340

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x, this.roomCenter.y - 1, this.roomName), 'terminal');
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 30 mins to fix
                          src/room/planner/variation-builder.ts on lines 350..350

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

                          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

                                  this.placementManager.planLocation(new RoomPosition(this.roomCenter.x, this.roomCenter.y + 1, this.roomName), 'storage');
                          Severity: Minor
                          Found in src/room/planner/variation-builder.ts and 1 other location - About 30 mins to fix
                          src/room/planner/variation-builder.ts on lines 351..351

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

                          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

                          There are no issues that match your filters.

                          Category
                          Status