src/types/datStatus.ts
File datStatus.ts
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { writeToString } from '@fast-csv/format';
import chalk, { ChalkInstance } from 'chalk';
import ArrayPoly from '../polyfill/arrayPoly.js';
import DAT from './dats/dat.js';
Function toCsv
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async toCsv(options: Options): Promise<string> {
const foundReleaseCandidates = DATStatus.getValuesForAllowedTypes(
options,
this.foundRomTypesToReleaseCandidates,
);
Function toCsv
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
async toCsv(options: Options): Promise<string> {
const foundReleaseCandidates = DATStatus.getValuesForAllowedTypes(
options,
this.foundRomTypesToReleaseCandidates,
);
- 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 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
dat: DAT,
options: Options,
parentsToReleaseCandidates: Map<Parent, ReleaseCandidate[]>,
) {
Function rows
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
.map((game) => {
let status = GameStatus.MISSING;
if (this.ignoredHashCodesToGames.has(game.hashCode())) {
status = GameStatus.IGNORED;
Function getAllowedTypes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
private static getAllowedTypes(options: Options): ROMType[] {
return [
!options.getOnlyBios() && !options.getOnlyDevice() && !options.getOnlyRetail()
? ROMType.GAME
: undefined,
- 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 toConsole
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
toConsole(options: Options): string {
return `${DATStatus.getAllowedTypes(options)
.filter((type) => this.allRomTypesToGames.get(type)?.length)
.map((type) => {
const found = this.foundRomTypesToReleaseCandidates.get(type) ?? [];