emmercm/igir

View on GitHub

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
Severity: Major
Found in src/types/gameConsole.ts - About 3 days to fix

    Game has 56 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class Game implements GameProps {
      @Expose()
      readonly name: string;
    
      /**
    Severity: Major
    Found in src/types/dats/game.ts - About 1 day to fix

      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';
      Severity: Minor
      Found in src/types/dats/game.ts - About 7 hrs to fix

        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';
        
        
        Severity: Minor
        Found in src/modules/dats/datScanner.ts - About 7 hrs to fix

          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';
          
          
          Severity: Minor
          Found in src/types/files/file.ts - About 6 hrs to fix

            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';
            Severity: Minor
            Found in src/types/patches/vcdiffPatch.ts - About 6 hrs to fix

              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';
              Severity: Minor
              Found in src/polyfill/fsPoly.ts - About 5 hrs to fix

                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();
                Severity: Minor
                Found in src/polyfill/fsPoly.ts - About 5 hrs to fix

                  File has 38 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  @Exclude()
                  export default class File implements FileProps {
                    readonly filePath: string;
                  
                    @Expose()
                  Severity: Minor
                  Found in src/types/files/file.ts - About 5 hrs to fix

                    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) =>
                    Severity: Major
                    Found in src/modules/dats/datMergerSplitter.ts - About 4 hrs to fix

                      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, '')
                      Severity: Major
                      Found in src/modules/dats/datParentInferrer.ts - About 3 hrs to fix

                        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;
                        Severity: Minor
                        Found in src/types/files/file.ts - About 3 hrs to fix

                        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 ?? [];
                        Severity: Major
                        Found in src/types/options.ts - About 3 hrs to fix

                          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) {
                          Severity: Major
                          Found in src/modules/dats/datScanner.ts - About 3 hrs to fix

                            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';
                            Severity: Minor
                            Found in src/types/datStatus.ts - About 3 hrs to fix

                              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;
                              Severity: Minor
                              Found in src/types/files/archives/archiveEntry.ts - About 3 hrs to fix

                              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 () => {
                              Severity: Major
                              Found in src/types/files/archives/chd/chd.ts - About 3 hrs to fix

                                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> {
                                Severity: Major
                                Found in src/modules/candidates/candidatePatchGenerator.ts - About 3 hrs to fix

                                  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,
                                      );
                                  Severity: Major
                                  Found in src/types/datStatus.ts - About 3 hrs to fix

                                    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) {
                                    Severity: Minor
                                    Found in src/modules/dats/datScanner.ts - About 3 hrs to fix

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language