Showing 187 of 448 total issues
File gameConsole.ts
has 1245 lines of code (exceeds 250 allowed). Consider refactoring. Open
import path from 'node:path';
interface OutputTokens {
// Adam image has it's roms in the /ROMS/{adam} subdirectory
// @see https://github.com/eduardofilo/RG350_adam_image/wiki/En:-3.-Content-installation#roms
Game
has 56 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Game implements GameProps {
@Expose()
readonly name: string;
/**
File game.ts
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
import 'reflect-metadata';
import { Expose, Transform, Type } from 'class-transformer';
import ArrayPoly from '../../polyfill/arrayPoly.js';
File datScanner.ts
has 484 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as child_process from 'node:child_process';
import path from 'node:path';
import { parse } from '@fast-csv/parse';
File file.ts
has 443 lines of code (exceeds 250 allowed). Consider refactoring. Open
import fs, { OpenMode, PathLike } from 'node:fs';
import https from 'node:https';
import path from 'node:path';
import { Readable } from 'node:stream';
File vcdiffPatch.ts
has 439 lines of code (exceeds 250 allowed). Consider refactoring. Open
// eslint-disable-next-line max-classes-per-file
import FilePoly from '../../polyfill/filePoly.js';
import fsPoly from '../../polyfill/fsPoly.js';
import ExpectedError from '../expectedError.js';
import File from '../files/file.js';
File fsPoly.ts
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
import crypto from 'node:crypto';
import fs, { MakeDirectoryOptions, ObjectEncodingOptions, PathLike, RmOptions } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import util from 'node:util';
FsPoly
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
export default class FsPoly {
static readonly FILE_READING_CHUNK_SIZE = 64 * 1024; // 64KiB, Node.js v22 default
// Assume that all drives we're reading from or writing to were already mounted at startup
private static readonly DRIVES = nodeDiskInfo.getDiskInfoSync();
File
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
@Exclude()
export default class File implements FileProps {
readonly filePath: string;
@Expose()
Function mergeParent
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
private mergeParent(dat: DAT, parent: Parent, gameNamesToGames: Map<string, Game>): Game[] {
let games = parent.getGames();
// Sanitization
games = games.map((game) =>
Function stripGameVariants
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static stripGameVariants(name: string): string {
return (
name
// ***** Retail types *****
.replace(/\(Alt( [a-z0-9. ]*)?\)/i, '')
Function fileOf
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
static async fileOf(
fileProps: FileProps,
checksumBitmask: number = ChecksumBitmask.NONE,
): Promise<File> {
let finalSize = fileProps.size;
- 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 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(options?: OptionsProps) {
this.commands = options?.commands ?? [];
this.input = options?.input ?? [];
this.inputExclude = options?.inputExclude ?? [];
Function parseCmproDat
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
private parseCmproDat(datFile: File, fileContents: string): DAT | undefined {
/**
* Validation that this might be a CMPro file.
*/
if (fileContents.match(/^(clrmamepro|game|resource) \(\r?\n(\s.+\r?\n)+\)$/m) === null) {
File datStatus.ts
has 311 lines of code (exceeds 250 allowed). Consider refactoring. 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 entryOf
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
static async entryOf<A extends Archive>(
archiveEntryProps: ArchiveEntryProps<A>,
checksumBitmask: number = ChecksumBitmask.NONE,
): Promise<ArchiveEntry<A>> {
let finalSize = archiveEntryProps.size;
- 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 extractEntryToStreamCached
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async extractEntryToStreamCached<T>(
entryPath: string,
callback: (stream: Readable) => Promise<T> | T,
): Promise<T> {
await this.tempSingletonMutex.runExclusive(async () => {
Function buildPatchedParentsForReleaseCandidate
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async buildPatchedParentsForReleaseCandidate(
dat: DAT,
unpatchedReleaseCandidate: ReleaseCandidate,
crcToPatches: Map<string, Patch[]>,
): Promise<[Parent, ReleaseCandidate[]][] | undefined> {
Function toCsv
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
async toCsv(options: Options): Promise<string> {
const foundReleaseCandidates = DATStatus.getValuesForAllowedTypes(
options,
this.foundRomTypesToReleaseCandidates,
);
Function parseCmproDat
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private parseCmproDat(datFile: File, fileContents: string): DAT | undefined {
/**
* Validation that this might be a CMPro file.
*/
if (fileContents.match(/^(clrmamepro|game|resource) \(\r?\n(\s.+\r?\n)+\)$/m) === null) {
- 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"