Showing 886 of 1,349 total issues
Function chooseNewExpansionTarget
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
chooseNewExpansionTarget() {
if (!hivemind.segmentMemory.isReady()) return;
// Choose a room to expand to.
let bestTarget;
- 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 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 manageExtractors
has a Cognitive Complexity of 29 (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
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 performPickup
has a Cognitive Complexity of 28 (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 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
RemoteMiningOperation
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
export default class RemoteMiningOperation extends Operation {
protected memory: RemoteMiningOperationMemory;
protected pathManager: PathManager;
/**
File builder.mines.ts
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global FIND_DROPPED_RESOURCES RESOURCE_ENERGY OK
ERR_NO_PATH ERR_NOT_IN_RANGE FIND_STRUCTURES STRUCTURE_CONTAINER STRUCTURE_ROAD
FIND_MY_CONSTRUCTION_SITES LOOK_STRUCTURES MAX_CONSTRUCTION_SITES
LOOK_CONSTRUCTION_SITES */
Function performRemoteBuild
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
performRemoteBuild() {
const creep: Creep = this.creep;
// Try and prevent controller downgrades.
if (creep.room.isMine() && !creep.room.controller.upgradeBlocked && (creep.room.controller.level < 2 || creep.room.controller.ticksToDowngrade < 500)) {
- 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 getDismantlePositions
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
getDismantlePositions(sourceLocation: string): RoomPosition[] {
if (!hivemind.segmentMemory.isReady()) return [];
// No dismantlers for SK rooms, they get confused easily...
const roomIntel = getRoomIntel(this.roomName);
- 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 getRemoteMiningSourceRooms
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
getRemoteMiningSourceRooms(): Record<string, SourceRoomAvailability> {
const sourceRooms: Record<string, SourceRoomAvailability> = {};
// Determine how much remote mining each room can handle.
for (const room of Game.myRooms) {
- 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 assertMilitaryCreepPower
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Room.prototype.assertMilitaryCreepPower = function (this: Room, creep: Creep | PowerCreep) {
let hostile: boolean;
let targets: Array<Creep | PowerCreep>;
let allies: Array<Creep | PowerCreep>;
if (creep.my) {
- 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 run
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
run() {
// @todo Find labs not used for reactions, to do creep boosts.
this.room.memory.canPerformReactions = false;
const labs = _.filter(this.room.myStructuresByType[STRUCTURE_LAB], structure => structure.isOperational());
- 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"