emmercm/igir

View on GitHub

Showing 444 of 448 total issues

Function scanPaths has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  private static async scanPaths(
    globPatterns: string[],
    walkCallback?: FsWalkCallback,
    requireFiles = true,
  ): Promise<string[]> {
Severity: Minor
Found in src/types/options.ts - About 1 hr 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 applyPatch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private static async applyPatch(
    patchFile: FilePoly,
    sourceFile: FilePoly,
    targetFile: FilePoly,
  ): Promise<void> {
Severity: Minor
Found in src/types/patches/bpsPatch.ts - About 1 hr to fix

    Function getEmptyDirs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private static async getEmptyDirs(dirsToClean: string | string[]): Promise<string[]> {
        if (Array.isArray(dirsToClean)) {
          return (
            await Promise.all(
              dirsToClean.map(async (dirToClean) => DirectoryCleaner.getEmptyDirs(dirToClean)),
    Severity: Minor
    Found in src/modules/directoryCleaner.ts - About 1 hr to fix

      Function applyPatchWindow has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private static async applyPatchWindow(
          sourceFile: FilePoly,
          targetFile: FilePoly,
          header: VcdiffHeader,
          copyCache: VcdiffCache,
      Severity: Minor
      Found in src/types/patches/vcdiffPatch.ts - About 1 hr to fix

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

            this.progressBar.logTrace(
              `${dat.getNameShort()}: correcting ${romsThatNeedCorrecting.toLocaleString()} output file extension${romsThatNeedCorrecting !== 1 ? 's' : ''}`,
            );
        Severity: Major
        Found in src/modules/candidates/candidateExtensionCorrector.ts and 1 other location - About 1 hr to fix
        src/modules/candidates/candidateArchiveFileHasher.ts on lines 62..64

        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 56.

        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 3 locations. Consider refactoring.
        Open

          @Expose()
          @Transform(({ value }) => value?.toLowerCase().replace(/^0x/, '').padStart(32, '0'))
          readonly md5?: string;
        Severity: Major
        Found in src/types/dats/rom.ts and 2 other locations - About 1 hr to fix
        src/types/dats/rom.ts on lines 36..38
        src/types/dats/rom.ts on lines 40..42

        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 56.

        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

            this.progressBar.logTrace(
              `${dat.getNameShort()}: generating ${archiveFileCount.toLocaleString()} hashed ArchiveFile candidate${archiveFileCount !== 1 ? 's' : ''}`,
            );
        Severity: Major
        Found in src/modules/candidates/candidateArchiveFileHasher.ts and 1 other location - About 1 hr to fix
        src/modules/candidates/candidateExtensionCorrector.ts on lines 65..67

        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 56.

        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 3 locations. Consider refactoring.
        Open

          @Expose()
          @Transform(({ value }) => value?.toLowerCase().replace(/^0x/, '').padStart(40, '0'))
          readonly sha1?: string;
        Severity: Major
        Found in src/types/dats/rom.ts and 2 other locations - About 1 hr to fix
        src/types/dats/rom.ts on lines 32..34
        src/types/dats/rom.ts on lines 40..42

        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 56.

        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 3 locations. Consider refactoring.
        Open

          @Expose()
          @Transform(({ value }) => value?.toLowerCase().replace(/^0x/, '').padStart(64, '0'))
          readonly sha256?: string;
        Severity: Major
        Found in src/types/dats/rom.ts and 2 other locations - About 1 hr to fix
        src/types/dats/rom.ts on lines 32..34
        src/types/dats/rom.ts on lines 36..38

        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 56.

        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

        Function shouldFilterOut has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private shouldFilterOut(dat: DAT): boolean {
            const datNameRegex = this.options.getDatNameRegex();
            if (datNameRegex && !datNameRegex.some((regex) => regex.test(dat.getName()))) {
              return true;
            }
        Severity: Minor
        Found in src/modules/dats/datScanner.ts - About 1 hr to fix

          Function parseDatFiles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private async parseDatFiles(datFiles: File[]): Promise<DAT[]> {
              this.progressBar.logTrace(
                `parsing ${datFiles.length.toLocaleString()} DAT file${datFiles.length !== 1 ? 's' : ''}`,
              );
              this.progressBar.setSymbol(ProgressBarSymbol.DAT_PARSING);
          Severity: Minor
          Found in src/modules/dats/datScanner.ts - About 1 hr to fix

            Function constructor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              protected constructor(fileProps: FileProps) {
                this.filePath = path.normalize(fileProps.filePath);
                this.size = fileProps.size ?? 0;
                this.checksumBitmask = fileProps.checksumBitmask;
                this.crc32 = fileProps.crc32?.toLowerCase().replace(/^0x/, '').padStart(8, '0');
            Severity: Minor
            Found in src/types/files/file.ts - About 1 hr to fix

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

                @Expose()
                @Type(() => Part)
                @Transform(({ value }) => value || [])
                readonly part?: Part | Part[];
              Severity: Major
              Found in src/types/dats/softwarelist/software.ts and 3 other locations - About 1 hr to fix
              src/types/dats/game.ts on lines 123..126
              src/types/dats/game.ts on lines 128..131
              src/types/dats/softwarelist/softwareListDat.ts on lines 18..21

              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 55.

              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 4 locations. Consider refactoring.
              Open

                @Expose()
                @Type(() => Software)
                @Transform(({ value }) => value || [])
                readonly software?: Software | Software[];
              Severity: Major
              Found in src/types/dats/softwarelist/softwareListDat.ts and 3 other locations - About 1 hr to fix
              src/types/dats/game.ts on lines 123..126
              src/types/dats/game.ts on lines 128..131
              src/types/dats/softwarelist/software.ts on lines 11..14

              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 55.

              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 4 locations. Consider refactoring.
              Open

                @Expose()
                @Type(() => Disk)
                @Transform(({ value }) => value || [])
                readonly disk?: Disk | Disk[];
              Severity: Major
              Found in src/types/dats/game.ts and 3 other locations - About 1 hr to fix
              src/types/dats/game.ts on lines 123..126
              src/types/dats/softwarelist/software.ts on lines 11..14
              src/types/dats/softwarelist/softwareListDat.ts on lines 18..21

              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 55.

              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 4 locations. Consider refactoring.
              Open

                @Expose()
                @Type(() => ROM)
                @Transform(({ value }) => value || [])
                readonly rom?: ROM | ROM[];
              Severity: Major
              Found in src/types/dats/game.ts and 3 other locations - About 1 hr to fix
              src/types/dats/game.ts on lines 128..131
              src/types/dats/softwarelist/software.ts on lines 11..14
              src/types/dats/softwarelist/softwareListDat.ts on lines 18..21

              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 55.

              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

                hasHack(): boolean {
                  return this.name.match(/\(Hack\)/i) !== null || this.name.match(/\[h[a-zA-Z90-9+]*\]/) !== null;
                }
              Severity: Major
              Found in src/types/dats/game.ts and 1 other location - About 1 hr to fix
              src/types/dats/game.ts on lines 396..400

              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 55.

              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

                isPirated(): boolean {
                  return (
                    this.name.match(/\(Pirate[a-z0-9. ]*\)/i) !== null || this.name.match(/\[p[0-9]*\]/) !== null
                  );
                }
              Severity: Major
              Found in src/types/dats/game.ts and 1 other location - About 1 hr to fix
              src/types/dats/game.ts on lines 461..463

              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 55.

              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

                  new GameConsole(/Neo ?Geo Pocket/i, ['.ngp'], {
                    adam: 'NGP',
                    batocera: 'ngp',
                    emulationstation: 'ngp',
                    funkeyos: 'Neo Geo Pocket',
              Severity: Minor
              Found in src/types/gameConsole.ts and 1 other location - About 55 mins to fix
              src/types/gameConsole.ts on lines 1171..1182

              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 54.

              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

                    {
                      adam: 'SEGACD',
                      batocera: 'segacd',
                      emulationstation: 'segacd',
                      jelos: 'segacd',
              Severity: Minor
              Found in src/types/gameConsole.ts and 1 other location - About 55 mins to fix
              src/types/gameConsole.ts on lines 1133..1144

              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 54.

              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

              Severity
              Category
              Status
              Source
              Language