src/empire/remote-mine-prioritizer.ts
Function getRemoteMiningSourceRooms
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
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 getRoomsToMine
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
getRoomsToMine(maxAmount: number): {rooms: string[]; maxRooms: number} {
const result: string[] = [];
const sourceRooms = this.getRemoteMiningSourceRooms();
// Create ordered list of best harvest rooms.
- 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
Consider simplifying this complex logical expression. Open
Open
if (
Game.shard.name === 'shardSeason'
&& roomName !== 'E34N16'
&& roomName !== 'E34N15'
&& roomName !== 'E36N14'
Function getRemoteMiningSourceRooms
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function getRoomsToMine
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getRoomsToMine(maxAmount: number): {rooms: string[]; maxRooms: number} {
const result: string[] = [];
const sourceRooms = this.getRemoteMiningSourceRooms();
// Create ordered list of best harvest rooms.