Showing 900 of 1,365 total issues
Function addIntershardSpawnOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
addIntershardSpawnOptions(options: ReclaimSpawnOption[]) {
const interShardMemory = interShard.getLocalMemory();
for (const shardName in (interShardMemory.portals || {})) {
const shardMemory = interShard.getRemoteMemory(shardName);
if (!shardMemory?.info?.rooms?.reclaimable) 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
Function constructor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
constructor() {
this.allies = [];
this.enemies = [];
if (localRelations?.allies) {
- 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 getReclaimSpawnOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getReclaimSpawnOptions(room: Room, options: BrawlerSpawnOption[]) {
if (room.getEffectiveAvailableEnergy() < 10_000) return;
for (const targetRoom of Game.myRooms) {
if (room.name === targetRoom.name) 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
Function generateScoutTargets
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
generateScoutTargets() {
const roomList = Memory.strategy.roomList || {};
const openList = this.getScoutOrigins();
const closedList: Record<string, boolean> = {};
- 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 addIntershardSpawnOptionsFor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
addIntershardSpawnOptionsFor(request: {name: string; safe: boolean; rcl: number; portalRoom?: string}, shardName: string, options: ReclaimSpawnOption[]) {
if (!request.portalRoom) return;
if (request.rcl < 4) return;
if (!request.safe) 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 drawExpansionStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
drawExpansionStatus() {
if (!Memory.strategy.expand) return;
// Visualize failed expansion attempts.
for (const attempt of Memory.strategy.expand.failedExpansions || []) {
- 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 registerCaravan
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
registerCaravan(id: string) {
if (!Memory.strategy) Memory.strategy = {};
if (!Memory.strategy.caravans) Memory.strategy.caravans = {};
const creeps = _.sortBy(_.filter(this.room.enemyCreeps[SYSTEM_USERNAME], c => c.name.startsWith(id)), c => c.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 needsSpawning
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
needsSpawning(room: Room, squad: Squad): SquadUnitType | null {
const neededUnits: SquadUnitType[] = [];
for (const unitType in squad.memory.composition) {
if (!availableUnitTypes.includes(unitType as SquadUnitType)) 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
Function getAllRequestedBoosts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private getAllRequestedBoosts(): Partial<Record<ResourceConstant, number>> {
const boosts = {};
for (const creepName in this.memory.creeps) {
if (Game.creeps[creepName]?.room?.name !== this.room.name) 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
Function refillFrom
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
refillFrom(creep: Creep) {
const needsRefill = this.getStructuresNeedingRefill();
if (needsRefill.length === 0) return false;
const target = _.min(needsRefill, extension => (bayStructures as string[]).indexOf(extension.structureType));
- 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 visualize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
visualize() {
const visual = new RoomVisual(this.roomName);
for (const type in this.positionsByType) {
if (!structureSymbols[type]) 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
Function isRoomRecovering
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
isRoomRecovering(): boolean {
if ((this.room.controller.safeMode ?? 0) > 5000) return false;
if (this.room.needsReclaiming()) return true;
if (this.structuresByType[STRUCTURE_SPAWN] && this.structuresByType[STRUCTURE_SPAWN].length > 0) return 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 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);
- 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 isPositionAccessible
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
isPositionAccessible(pos: RoomPosition, noTunnels?: boolean) {
// We don't care about cost, just about possibility.
const result = PathFinder.search(pos, this.originEntrances, {
roomCallback: () => this.buildingMatrix,
maxRooms: 1,
- 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 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;
- 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 findAccessRoad
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
findAccessRoad(from: RoomPosition, to: RoomPosition | RoomPosition[], breakExtensions?: boolean): RoomPosition[] {
const result = PathFinder.search(from, to, {
roomCallback: () => {
if (!breakExtensions) return this.buildingMatrix;
- 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 scoreExtractorPositions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
scoreExtractorPositions(positions: RoomPosition[]): ScoredExtractorPosition[] {
const result: ScoredExtractorPosition[] = [];
for (const position of positions) {
const mineral = position.lookFor(LOOK_MINERALS)[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 buildPlannedStructures
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
buildPlannedStructures(locationType: string, structureType: StructureConstant, filterCallback?: (pos: RoomPosition) => boolean): boolean {
let canBuildMore = true;
for (const pos of this.roomPlanner.getLocations(locationType)) {
if (filterCallback && !filterCallback(pos)) continue;
if (this.tryBuild(pos, structureType)) 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
Function getLocalMemory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getLocalMemory(): ShardMemory {
if (typeof InterShardMemory === 'undefined') {
// Create mock intershard memory object.
if (!Memory.interShardReplacement) Memory.interShardReplacement = {};
- 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 checkWallIntegrity
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
checkWallIntegrity(minHits?: number) {
// @todo make this consistent with defense manager.
if (!minHits) minHits = hivemind.settings.get('minWallIntegrity');
const maxHealth = hivemind.settings.get('maxWallHealth');
- 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"