Showing 492 of 594 total issues
Function pickupEnergyFromGround
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Creep.prototype.pickupEnergyFromGround = function() {
const resources = this.pos.findInRange(FIND_DROPPED_RESOURCES, 1, {
filter: {resourceType: RESOURCE_ENERGY},
});
if (resources.length > 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 getRoute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Creep.prototype.getRoute = function() {
if (this.memory.routing.route) {
return this.memory.routing.route;
}
- 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 checkPositions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Room.prototype.checkPositions = function() {
for (const type of [STRUCTURE_SPAWN, STRUCTURE_EXTENSION, STRUCTURE_TOWER, STRUCTURE_LINK, STRUCTURE_OBSERVER, STRUCTURE_NUKER, STRUCTURE_FACTORY]) {
if ((this.data.positions.structure[type] || []).length < CONTROLLER_STRUCTURES[type][8]) {
let output = 'Structures not found:\n';
for (const type of Object.keys(this.data.positions.structure)) {
- 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 action
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
roles.powerdefender.action = function(creep) {
if (creep.hits < 200) {
return false;
}
const hostileCreeps = creep.room.findEnemies();
- 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 getPathLength
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getPathLength(pathObject) {
let lastPos;
let value = 0;
for (const pos of pathObject.path) {
let valueAdd = 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 findKeepersAt
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Room.prototype.findKeepersAt = function(roles, posId) {
const s = Game.getObjectById(posId);
const type = s.energy > 0 ? 'energy' : ((s.mineralAmount > 0) ? 'mineral' : 'offline');
const amount = (s.energy > 1000) ? s.energy : ((s.mineralAmount > 2000) ? s.mineralAmount : false);
const room = this;
- 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 updateSkippedRoomsLog
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function updateSkippedRoomsLog() {
Memory.skippedRoomsLog = Memory.skippedRoomsLog || {};
if (_.size(Memory.skippedRooms) > 0) {
console.log(`${Game.time} cpu.getUsed: ${_.round(Game.cpu.getUsed())} tickLimit: ${Game.cpu.tickLimit} Bucket: ${Game.cpu.bucket} skippedRooms ${Memory.skippedRooms}`);
Memory.skippedRoomsLog[Game.time] = Memory.skippedRooms;
- 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 isClaimableRoom
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function isClaimableRoom(roomName) {
const data = global.data.rooms[roomName];
if (Memory.myRooms.indexOf(roomName) >= 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 checkForSuccess
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async checkForSuccess(line, defer) {
if (botsSpawned && line.startsWith(`'OK'`)) {
let appendix = '';
if (this.maxRuntime > 0) {
appendix = ` with runtime ${this.maxRuntime / 60} minutes`;
- 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 action
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
roles.towerdrainer.action = function(creep) {
const attackRoom = creep.memory.attackRoom;
const restPos = roles.towerdrainer.getRestPosition(creep);
if (!restPos) {
creep.log('no position');
- 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 getFailedRooms
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getFailedRooms(milestone) {
const failedRooms = [];
for (const room of Object.keys(status)) {
for (const key of Object.keys(milestone.check)) {
if (status[room][key] < milestone.check[key]) {
- 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 handleNextroomer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
brain.handleNextroomer = function() {
if (!Memory.myRooms) {
return;
}
if (Memory.myRooms.length >= Game.gcl.level) {
- 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"