Showing 899 of 1,362 total issues
Function followCachedPath
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
Creep.prototype.followCachedPath = function (this: Creep | PowerCreep) {
drawCreepMovement(this);
container.get('TrafficManager').setMoving(this);
this.heapMemory._moveBlocked = false;
- Read upRead up
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 createNavigationMatrix
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
createNavigationMatrix(): CostMatrix {
const matrix = new PathFinder.CostMatrix();
const terrain = new Room.Terrain(this.roomName);
for (const locationType of this.getPositionTypes()) {
- Read upRead up
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
File builder.remote.ts
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global RoomPosition FIND_SOURCES FIND_STRUCTURES STRUCTURE_SPAWN
FIND_MY_STRUCTURES RESOURCE_ENERGY ERR_NOT_IN_RANGE STRUCTURE_RAMPART
FIND_MY_CONSTRUCTION_SITES STRUCTURE_TOWER FIND_DROPPED_RESOURCES
STRUCTURE_CONTAINER FIND_SOURCES_ACTIVE */
Function findPath
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
findPath(startPos: RoomPosition, endPos: RoomPosition, options?: {maxPathLength?: number; allowDanger?: boolean; maxCpu?: number}): {
path?: RoomPosition[];
length?: number;
incomplete: boolean;
} {
Function cleanup
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
cleanup() {
// Periodically clean creep memory.
if (Game.time % 16 === 7) {
for (const name in Memory.creeps) {
if (!Game.creeps[name]) {
- Read upRead up
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 manageExtractors
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
manageExtractors() {
const plannedLocations = this.roomPlanner.getLocations('extractor');
if (plannedLocations.length <= CONTROLLER_STRUCTURES[STRUCTURE_EXTRACTOR][this.room.controller.level]) {
this.buildPlannedStructures('extractor', STRUCTURE_EXTRACTOR);
return;
- Read upRead up
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
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, {
File combat-manager.ts
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
import hivemind from 'hivemind';
import utilities from 'utilities';
import {getResourcesIn} from 'utils/store';
import {handleMapArea} from 'utils/map';
Function addObjectResourceOptions
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
addObjectResourceOptions(options: TransporterSourceOrderOption[], findConstant: FIND_RUINS | FIND_TOMBSTONES | FIND_DROPPED_RESOURCES, optionType: 'resource' | 'tombstone') {
const creep = this.creep;
// Look for resources on the ground.
const targets = creep.room.find(findConstant, {
- Read upRead up
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 addResourceRequestOptions
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private addResourceRequestOptions(options: TransportRouteOption[], room: Room, resourceType: ResourceConstant, roomState: RoomResourceState) {
// Fullfill allies trade requests.
for (const roomName2 in Memory?.requests?.trade?.[resourceType] || {}) {
const info = Memory.requests.trade[resourceType][roomName2];
if (Game.time - info.lastSeen > 10) {
- Read upRead up
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 calculateRoomPriorities
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
calculateRoomPriorities(roomName: string) {
const roomIntel = getRoomIntel(roomName);
const info = Memory.strategy.roomList[roomName];
info.scoutPriority = 0;
- Read upRead up
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 findBayPosition
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
findBayPosition(): RoomPosition {
let maxExtensions = 0;
let bestPos = null;
let bestScore = 0;
- Read upRead up
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 performMilitaryMove
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
performMilitaryMove(creep: BrawlerCreep) {
if (creep.isPartOfTrain() && this.performTrainMove(creep) !== OK) return;
if (creep.memory.fillWithEnergy) {
if (creep.room.isMine() && creep.store.getFreeCapacity() > 0) {
- Read upRead up
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 chooseNewExpansionTarget
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
chooseNewExpansionTarget() {
// Choose a room to expand to.
let bestTarget;
let modifiedBestExpansionScore: number;
const startTime = Game.cpu.getUsed();
- Read upRead up
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 checkAdjacentRooms
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
checkAdjacentRooms() {
if (!this.memory.adjacentSafe) {
this.memory.adjacentSafe = {
N: false,
E: false,
- Read upRead up
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 buildEndgameStructures
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
buildEndgameStructures() {
if (this.room.terminal) {
// Once there is a terminal, build quad-breaker walls.
this.buildPlannedStructures('wall.quad', STRUCTURE_WALL);
}
- Read upRead up
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 performPickup
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
performPickup(creep: RelayHaulerCreep) {
creep.say('p0');
const sourcePosition = decodePosition(creep.memory.source);
if (!sourcePosition) {
creep.say('newtar');
- Read upRead up
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 cleanRoom
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
cleanRoom() {
// Remove all extensions and labs blocking roads or bays (from redesigning rooms).
for (const extension of this.structuresByType[STRUCTURE_EXTENSION] || []) {
if (this.roomPlanner.isPlannedLocation(extension.pos, 'extension')) continue;
if (!this.roomPlanner.isPlannedLocation(extension.pos, 'road')) continue;
- Read upRead up
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
RemoteMiningOperation
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
export default class RemoteMiningOperation extends Operation {
protected memory: RemoteMiningOperationMemory;
protected pathManager: PathManager;
/**
Function manageStructures
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
manageStructures() {
if (_.size(Game.spawns) === 1 && _.sample(Game.spawns).room.name === this.room.name && this.room.controller.level < 4) {
// In our first room, getting more extensions is pretty important for
// spawning bigger creeps asap.
this.manageExtensions();