Showing 492 of 594 total issues
File prototype_room_external.js
has 610 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
const {getMyRoomWithinRange, findMyRoomsSortByDistance} = require('./helper_findMyRooms');
const {addToReputation, initPlayer, addRoomToPlayer} = require('./diplomacy');
const {haveActiveQuest} = require('./quests_player');
File prototype_room_my.js
has 592 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
const {findMyRoomsSortByDistance} = require('./helper_findMyRooms');
const {addToReputation} = require('./diplomacy');
const {isFriend} = require('./brain_squadmanager');
Function exports
has 232 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
let account;
try {
account = require('./account.screeps.com'); // eslint-disable-line global-require
} catch (e) {
File prototype_creep_resources.js
has 526 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
Creep.pickableResources = function(creep) {
return (object) => creep.pos.isNearTo(object);
};
File prototype_room_creepbuilder.js
has 447 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
const {
CreepPartData,
sortCreepParts,
File prototype_room_init.js
has 441 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
// TODO this does not need to be on the Room object
Room.prototype.setPosition = function(type, pos, value = config.layout.structureAvoid, positionType = 'structure', firstStructure = false) {
this.debugLog('baseBuilding', `Increasing ${pos} ${type} ${positionType} with ${value}`);
Function action
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
roles.atkeeper.action = function(creep) {
// TODO Untested
creep.spawnReplacement();
creep.setNextSpawn();
const center = new RoomPosition(25, 25, creep.memory.routing.targetRoom);
- 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 34 (exceeds 5 allowed). Consider refactoring. Open
roles.atkeepermelee.action = function(creep) {
// TODO Untested
creep.spawnReplacement();
creep.setNextSpawn();
creep.memory.canHeal = creep.getActiveBodyparts(HEAL) > 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
File prototype_creep.js
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
const {addToReputation} = require('./diplomacy');
/**
Function setLabs
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
Room.prototype.setLabs = function(allPaths) {
let lab1Pos;
let lab2Pos;
let pathI;
let path;
- 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 checkBlockedPath
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
Room.prototype.checkBlockedPath = function() {
for (const pathName of Object.keys(this.getMemoryPaths())) {
const path = this.getMemoryPath(pathName) || {};
for (const pos of path) {
const roomPos = new RoomPosition(pos.x, pos.y, this.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
File prototype_room_basebuilder.js
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
/**
* posIsIn position is in array
*
Function showSearch
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
showSearch(search) {
if (search) {
const rv = {};
const getRV = (pos) => {
if (!rv[pos.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
File prototype_creep_startup_tasks.js
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
Creep.execute = function(creep, methods) {
for (const method of methods) {
if (method(creep)) {
File role_mineral.js
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
/*
* mineral manages the mineral distributions
*
Function showCreeps
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
showCreeps() {
for (const room of _.values(Game.rooms)) {
if (!room.isMy()) {
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 updateCostMatrixFromPositions
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function updateCostMatrixFromPositions(room, costMatrix) {
for (const positionType of Object.keys(room.data.positions)) {
if (positionType === 'pathEndLevel' || positionType === 'version') {
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 sellByOwnOrders
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Room.prototype.sellByOwnOrders = function(resource, sellAmount) {
const avgBuyPrice = brain.getMarketOrderAverage(ORDER_BUY, resource);
const avgSellPrice = brain.getMarketOrderAverage(ORDER_SELL, resource);
const mySellPrice = Math.max((avgBuyPrice || 1) * config.market.sellOrderPriceMultiplicand, config.market.minSellPrice);
if (!avgSellPrice || mySellPrice <= avgSellPrice) {
- 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 preMove
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
roles.carry.preMove = function(creep, directions) {
if (!validateDirections(creep, directions)) {
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 orderMinerals
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Room.prototype.orderMinerals = function() {
if (this.executeEveryTicks(20)) {
const room = this;
for (const mineral of baseMinerals) {
- 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"