emmercm/igir

View on GitHub

Showing 444 of 448 total issues

Function getOrComputeFileSignature has 33 lines of code (exceeds 25 allowed). 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: Minor
Found in src/types/files/fileCache.ts - About 1 hr to fix

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

          if (sha1) {
            if (!sha1RawMap.has(sha1)) {
              sha1RawMap.set(sha1, [file]);
            } else {
              sha1RawMap.get(sha1)?.unshift(file);
    Severity: Major
    Found in src/types/indexedFiles.ts and 5 other locations - About 1 hr to fix
    src/types/indexedFiles.ts on lines 63..69
    src/types/indexedFiles.ts on lines 81..87
    src/types/indexedFiles.ts on lines 98..104
    src/types/indexedFiles.ts on lines 107..113
    src/types/indexedFiles.ts on lines 116..122

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

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

          if (md5) {
            if (!md5RawMap.has(md5)) {
              md5RawMap.set(md5, [file]);
            } else {
              md5RawMap.get(md5)?.unshift(file);
    Severity: Major
    Found in src/types/indexedFiles.ts and 5 other locations - About 1 hr to fix
    src/types/indexedFiles.ts on lines 72..78
    src/types/indexedFiles.ts on lines 81..87
    src/types/indexedFiles.ts on lines 98..104
    src/types/indexedFiles.ts on lines 107..113
    src/types/indexedFiles.ts on lines 116..122

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

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

            if (md5WithoutHeader) {
              if (!md5WithoutHeaderMap.has(md5WithoutHeader)) {
                md5WithoutHeaderMap.set(md5WithoutHeader, [file]);
              } else {
                md5WithoutHeaderMap.get(md5WithoutHeader)?.push(file);
    Severity: Major
    Found in src/types/indexedFiles.ts and 5 other locations - About 1 hr to fix
    src/types/indexedFiles.ts on lines 63..69
    src/types/indexedFiles.ts on lines 72..78
    src/types/indexedFiles.ts on lines 81..87
    src/types/indexedFiles.ts on lines 107..113
    src/types/indexedFiles.ts on lines 116..122

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

    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

        gb: new FileSignature('.gb', [
          {
            offset: 0x01_04,
            value: Buffer.from(
              'CEED6666CC0D000B03730083000C000D0008111F8889000EDCCC6EE6DDDDD999BBBB67636E0EECCCDDDC999FBBB9333E',
    Severity: Major
    Found in src/types/files/fileSignature.ts and 1 other location - About 1 hr to fix
    src/types/files/fileSignature.ts on lines 160..169

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

    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

      logger.info(
        `Include: found ${FsPoly.sizeReadable(includeSize)} of ${include.size.toLocaleString()} file${include.size !== 1 ? 's' : ''} to include`,
      );
    Severity: Major
    Found in package.ts and 1 other location - About 1 hr to fix
    package.ts on lines 130..132

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

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

            if (sha256WithoutHeader) {
              if (!sha256WithoutHeaderMap.has(sha256WithoutHeader)) {
                sha256WithoutHeaderMap.set(sha256WithoutHeader, [file]);
              } else {
                sha256WithoutHeaderMap.get(sha256WithoutHeader)?.push(file);
    Severity: Major
    Found in src/types/indexedFiles.ts and 5 other locations - About 1 hr to fix
    src/types/indexedFiles.ts on lines 63..69
    src/types/indexedFiles.ts on lines 72..78
    src/types/indexedFiles.ts on lines 81..87
    src/types/indexedFiles.ts on lines 98..104
    src/types/indexedFiles.ts on lines 107..113

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

    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

        if (this.options.getPreferRevision() === PreferRevision.OLDER) {
          return a.getGame().getRevision() - b.getGame().getRevision();
        }
    Severity: Major
    Found in src/modules/candidates/candidatePreferer.ts and 1 other location - About 1 hr to fix
    src/modules/candidates/candidatePreferer.ts on lines 215..217

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

    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(/Lynx/i, ['.lnx', '.lyx'], {
          adam: 'LYNX',
          batocera: 'lynx',
          emulationstation: 'atarilynx',
          funkeyos: 'Atari lynx',
    Severity: Major
    Found in src/types/gameConsole.ts and 1 other location - About 1 hr to fix
    src/types/gameConsole.ts on lines 1072..1083

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

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

          if (sha256) {
            if (!sha256RawMap.has(sha256)) {
              sha256RawMap.set(sha256, [file]);
            } else {
              sha256RawMap.get(sha256)?.unshift(file);
    Severity: Major
    Found in src/types/indexedFiles.ts and 5 other locations - About 1 hr to fix
    src/types/indexedFiles.ts on lines 63..69
    src/types/indexedFiles.ts on lines 72..78
    src/types/indexedFiles.ts on lines 98..104
    src/types/indexedFiles.ts on lines 107..113
    src/types/indexedFiles.ts on lines 116..122

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

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

            if (sha1WithoutHeader) {
              if (!sha1WithoutHeaderMap.has(sha1WithoutHeader)) {
                sha1WithoutHeaderMap.set(sha1WithoutHeader, [file]);
              } else {
                sha1WithoutHeaderMap.get(sha1WithoutHeader)?.push(file);
    Severity: Major
    Found in src/types/indexedFiles.ts and 5 other locations - About 1 hr to fix
    src/types/indexedFiles.ts on lines 63..69
    src/types/indexedFiles.ts on lines 72..78
    src/types/indexedFiles.ts on lines 81..87
    src/types/indexedFiles.ts on lines 98..104
    src/types/indexedFiles.ts on lines 116..122

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

    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(/SG[ -]?1000/i, ['.sc', '.sg'], {
          adam: 'SG1000',
          batocera: 'sg1000',
          emulationstation: 'sg-1000',
          jelos: 'sg-1000',
    Severity: Major
    Found in src/types/gameConsole.ts and 1 other location - About 1 hr to fix
    src/types/gameConsole.ts on lines 209..220

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

    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

        gb_dx: new FileSignature('.gbc', [
          {
            offset: 0x01_04,
            value: Buffer.from(
              'CEED6666CC0D000B03730083000C000D0008111F8889000EDCCC6EE6DDDDD999BBBB67636E0EECCCDDDC999FBBB9333E',
    Severity: Major
    Found in src/types/files/fileSignature.ts and 1 other location - About 1 hr to fix
    src/types/files/fileSignature.ts on lines 135..144

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

    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

        if (this.options.getPreferRevision() === PreferRevision.NEWER) {
          return b.getGame().getRevision() - a.getGame().getRevision();
        }
    Severity: Major
    Found in src/modules/candidates/candidatePreferer.ts and 1 other location - About 1 hr to fix
    src/modules/candidates/candidatePreferer.ts on lines 218..220

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

    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

      logger.info(
        `Exclude: found ${FsPoly.sizeReadable(excludeSize)} of ${exclude.length.toLocaleString()} file${exclude.length !== 1 ? 's' : ''} to exclude`,
      );
    Severity: Major
    Found in package.ts and 1 other location - About 1 hr to fix
    package.ts on lines 113..115

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

    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 parseMameListxml has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private async parseMameListxml(mameExecutable: File): Promise<DAT | undefined> {
        this.progressBar.logTrace(
          `${mameExecutable.toString()}: attempting to get ListXML from MAME executable`,
        );
    
    
    Severity: Minor
    Found in src/modules/dats/datScanner.ts - About 1 hr to fix

      Function prefer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        prefer(
          dat: DAT,
          parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
        ): Map<Parent, ReleaseCandidate[]> {
          this.progressBar.logTrace(`${dat.getNameShort()}: preferring candidates`);
      Severity: Minor
      Found in src/modules/candidates/candidatePreferer.ts - About 1 hr to fix

        Function fromFilePoly has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static async fromFilePoly(patchFile: FilePoly): Promise<VcdiffHeader> {
            const header = await patchFile.readNext(3);
            if (!header.equals(VcdiffHeader.FILE_SIGNATURE)) {
              await patchFile.close();
              throw new ExpectedError(`Vcdiff patch header is invalid: ${patchFile.getPathLike()}`);
        Severity: Minor
        Found in src/types/patches/vcdiffPatch.ts - About 1 hr to fix

          Function new has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static new(logger: Logger, name: string, symbol: string, initialTotal = 0): ProgressBarCLI {
              if (!ProgressBarCLI.multiBar) {
                ProgressBarCLI.multiBar = new cliProgress.MultiBar(
                  {
                    stream: logger.getLogLevel() < LogLevel.NEVER ? logger.getStream() : new PassThrough(),
          Severity: Minor
          Found in src/console/progressBarCli.ts - About 1 hr to fix

            Function filter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              filter(dat: DAT): DAT {
                // Return early if there aren't any games
                if (dat.getGames().length === 0) {
                  this.progressBar.logTrace(`${dat.getNameShort()}: no games to filter`);
                  return dat;
            Severity: Minor
            Found in src/modules/dats/datFilter.ts - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language