emmercm/igir

View on GitHub

Showing 444 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      static async patchFrom(file: File): Promise<UPSPatch> {
        let crcBefore = '';
        let crcAfter = '';
        let targetSize = 0;
    
    
    Severity: Major
    Found in src/types/patches/upsPatch.ts and 1 other location - About 2 days to fix
    src/types/patches/bpsPatch.ts on lines 24..55

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 414.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      static async patchFrom(file: File): Promise<BPSPatch> {
        let crcBefore = '';
        let crcAfter = '';
        let targetSize = 0;
    
    
    Severity: Major
    Found in src/types/patches/bpsPatch.ts and 1 other location - About 2 days to fix
    src/types/patches/upsPatch.ts on lines 21..52

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 414.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      async getOrComputeFileSignature(file: File): Promise<FileSignature | undefined> {
        // NOTE(cemmer): we're explicitly not catching ENOENT errors here, we want it to bubble up
        const stats = await FsPoly.stat(file.getFilePath());
        if (stats.size === 0) {
          // An empty file can't have a signature
    Severity: Major
    Found in src/types/files/fileCache.ts and 1 other location - About 1 day to fix
    src/types/files/fileCache.ts on lines 207..247

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 336.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      async getOrComputeFileHeader(file: File): Promise<ROMHeader | undefined> {
        // NOTE(cemmer): we're explicitly not catching ENOENT errors here, we want it to bubble up
        const stats = await FsPoly.stat(file.getFilePath());
        if (stats.size === 0) {
          // An empty file can't have a header
    Severity: Major
    Found in src/types/files/fileCache.ts and 1 other location - About 1 day to fix
    src/types/files/fileCache.ts on lines 249..289

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 336.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            static async canSymlink(dirPath: string): Promise<boolean> {
              const source = await this.mktemp(path.join(dirPath, 'source'));
              try {
                await this.touch(source);
                const target = await this.mktemp(path.join(dirPath, 'target'));
          Severity: Major
          Found in src/polyfill/fsPoly.ts and 1 other location - About 7 hrs to fix
          src/polyfill/fsPoly.ts on lines 21..37

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 182.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            static async canHardlink(dirPath: string): Promise<boolean> {
              const source = await this.mktemp(path.join(dirPath, 'source'));
              try {
                await this.touch(source);
                const target = await this.mktemp(path.join(dirPath, 'target'));
          Severity: Major
          Found in src/polyfill/fsPoly.ts and 1 other location - About 7 hrs to fix
          src/polyfill/fsPoly.ts on lines 39..55

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 182.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            getRequiredDiskChecksumBitmask(): number {
              let checksumBitmask = 0;
              this.getGames().forEach((game) =>
                game.getDisks().forEach((disk) => {
                  if (disk.getCrc32() && disk.getSize()) {
          Severity: Major
          Found in src/types/dats/dat.ts and 1 other location - About 6 hrs to fix
          src/types/dats/dat.ts on lines 112..128

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 171.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            getRequiredRomChecksumBitmask(): number {
              let checksumBitmask = 0;
              this.getGames().forEach((game) =>
                game.getRoms().forEach((rom) => {
                  if (rom.getCrc32() && rom.getSize()) {
          Severity: Major
          Found in src/types/dats/dat.ts and 1 other location - About 6 hrs to fix
          src/types/dats/dat.ts on lines 130..146

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 171.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export default class DataArea {
            // @Expose()
            // readonly name?: string;
          
            // @Expose()
          Severity: Major
          Found in src/types/dats/softwarelist/dataArea.ts and 1 other location - About 6 hrs to fix
          src/types/dats/softwarelist/part.ts on lines 8..33

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 169.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export default class Part {
            // @Expose()
            // readonly name?: string;
          
            // @Expose()
          Severity: Major
          Found in src/types/dats/softwarelist/part.ts and 1 other location - About 6 hrs to fix
          src/types/dats/softwarelist/dataArea.ts on lines 8..33

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 169.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  private static async writeOutputFile(
                    inputRomFile: File,
                    outputRomPath: string,
                    patchFile: FilePoly,
                  ): Promise<void> {
                Severity: Major
                Found in src/types/patches/dpsPatch.ts and 1 other location - About 5 hrs to fix
                src/types/patches/apsGbaPatch.ts on lines 47..65

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 152.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  private static async writeOutputFile(
                    inputRomFile: File,
                    outputRomPath: string,
                    patchFile: FilePoly,
                  ): Promise<void> {
                Severity: Major
                Found in src/types/patches/apsGbaPatch.ts and 1 other location - About 5 hrs to fix
                src/types/patches/dpsPatch.ts on lines 38..56

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 152.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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
                  Severity
                  Category
                  Status
                  Source
                  Language