emmercm/igir

View on GitHub

Showing 444 of 448 total issues

Function delete has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async delete(
    inputRoms: File[],
    movedRoms: File[],
    datsToWrittenFiles: Map<DAT, File[]>,
  ): Promise<string[]> {
Severity: Minor
Found in src/modules/movedRomDeleter.ts - About 1 hr to fix

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

          this.progressBar.logInfo(
            `deleting cleaned path${filePathsChunk.length !== 1 ? 's' : ''}:\n${filePathsChunk.map((filePath) => `  ${filePath}`).join('\n')}`,
          );
    Severity: Major
    Found in src/modules/directoryCleaner.ts and 2 other locations - About 1 hr to fix
    src/modules/directoryCleaner.ts on lines 107..109
    src/modules/movedRomDeleter.ts on lines 68..70

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

    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

          this.progressBar.logInfo(
            `deleting moved file${filePathChunk.length !== 1 ? 's' : ''}:\n${filePathChunk.map((filePath) => `  ${filePath}`).join('\n')}`,
          );
    Severity: Major
    Found in src/modules/movedRomDeleter.ts and 2 other locations - About 1 hr to fix
    src/modules/directoryCleaner.ts on lines 107..109
    src/modules/directoryCleaner.ts on lines 133..135

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

    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

          this.progressBar.logInfo(
            `recycling cleaned path${filePathsChunk.length !== 1 ? 's' : ''}:\n${filePathsChunk.map((filePath) => `  ${filePath}`).join('\n')}`,
          );
    Severity: Major
    Found in src/modules/directoryCleaner.ts and 2 other locations - About 1 hr to fix
    src/modules/directoryCleaner.ts on lines 133..135
    src/modules/movedRomDeleter.ts on lines 68..70

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

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

          .map((game) => {
            let status = GameStatus.MISSING;
    
            if (this.ignoredHashCodesToGames.has(game.hashCode())) {
              status = GameStatus.IGNORED;
    Severity: Minor
    Found in src/types/datStatus.ts - About 1 hr to fix

      Function applyPatchWindow has a Cognitive Complexity of 14 (exceeds 5 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

      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 entriesFromArchiveExtension has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        private async entriesFromArchiveExtension(
          filePath: string,
          checksumBitmask: number,
          fileExt = filePath.replace(/.+?(?=(\.[a-zA-Z0-9]+)+)/, ''),
        ): Promise<ArchiveEntry<Archive>[] | undefined> {
      Severity: Minor
      Found in src/types/files/fileFactory.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

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

            if (
              (!finalCrcWithHeader && checksumBitmask & ChecksumBitmask.CRC32) ||
              (!finalMd5WithHeader && checksumBitmask & ChecksumBitmask.MD5) ||
              (!finalSha1WithHeader && checksumBitmask & ChecksumBitmask.SHA1) ||
              (!finalSha256WithHeader && checksumBitmask & ChecksumBitmask.SHA256)
      Severity: Major
      Found in src/types/files/file.ts and 1 other location - About 1 hr to fix
      src/types/files/archives/archiveEntry.ts on lines 65..83

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

      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 (
              (!finalCrcWithHeader && checksumBitmask & ChecksumBitmask.CRC32) ||
              (!finalMd5WithHeader && checksumBitmask & ChecksumBitmask.MD5) ||
              (!finalSha1WithHeader && checksumBitmask & ChecksumBitmask.SHA1) ||
              (!finalSha256WithHeader && checksumBitmask & ChecksumBitmask.SHA256)
      Severity: Major
      Found in src/types/files/archives/archiveEntry.ts and 1 other location - About 1 hr to fix
      src/types/files/file.ts on lines 122..133

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

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

        private async applyCommandOpen(patchFile: FilePoly, targetFile: FilePoly): Promise<void> {
          const multiFile = (await patchFile.readNext(1)).readUInt8();
          if (multiFile > 0) {
            throw new ExpectedError(
              `Multi-file NINJA patches aren't supported: ${this.getFile().toString()}`,
      Severity: Minor
      Found in src/types/patches/ninjaPatch.ts - About 1 hr to fix

        Function parseCueFile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private static async parseCueFile<T extends Archive>(
            archive: T,
            file: CueFile,
            binFilePath: string,
            checksumBitmask: number,
        Severity: Minor
        Found in src/types/files/archives/chd/chdBinCueParser.ts - About 1 hr to fix

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

                  if (!checkArgv.input && needInput.length > 0) {
                    // TODO(cememr): print help message
                    throw new ExpectedError(
                      `Missing required argument for command${needInput.length !== 1 ? 's' : ''} ${needInput.join(', ')}: --input <path>`,
                    );
          Severity: Major
          Found in src/modules/argumentsParser.ts and 1 other location - About 1 hr to fix
          src/modules/argumentsParser.ts on lines 481..486

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

          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 (!checkArgv.output && needOutput.length > 0) {
                    // TODO(cememr): print help message
                    throw new ExpectedError(
                      `Missing required argument for command${needOutput.length !== 1 ? 's' : ''} ${needOutput.join(', ')}: --output <path>`,
                    );
          Severity: Major
          Found in src/modules/argumentsParser.ts and 1 other location - About 1 hr to fix
          src/modules/argumentsParser.ts on lines 203..208

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

          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

            public static readonly LANGUAGES = this.REGION_OPTIONS.map((regionOption) =>
              regionOption.language.toUpperCase(),
            )
              .filter((language) => language)
              .reduce(ArrayPoly.reduceUnique(), [])
          Severity: Major
          Found in src/types/internationalization.ts and 1 other location - About 1 hr to fix
          src/types/internationalization.ts on lines 210..215

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

          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

            public static readonly REGION_CODES = this.REGION_OPTIONS.map((regionOption) =>
              regionOption.region.toUpperCase(),
            )
              .filter((region) => region)
              .reduce(ArrayPoly.reduceUnique(), [])
          Severity: Major
          Found in src/types/internationalization.ts and 1 other location - About 1 hr to fix
          src/types/internationalization.ts on lines 222..227

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

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

            private filterOutPartiallyConsumedArchives(movedRoms: File[], inputRoms: File[]): string[] {
              const groupedInputRoms = MovedROMDeleter.groupFilesByFilePath(inputRoms);
              const groupedMovedRoms = MovedROMDeleter.groupFilesByFilePath(movedRoms);
          
              return [...groupedMovedRoms.entries()]
          Severity: Minor
          Found in src/modules/movedRomDeleter.ts - About 1 hr to fix

            Function correctExtensions has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private async correctExtensions(
                dat: DAT,
                parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
              ): Promise<Map<Parent, ReleaseCandidate[]>> {
                return new Map(
            Severity: Minor
            Found in src/modules/candidates/candidateExtensionCorrector.ts - About 1 hr to fix

              Function buildCorrectedRom has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private async buildCorrectedRom(
                  dat: DAT,
                  parent: Parent,
                  releaseCandidate: ReleaseCandidate,
                  romWithFiles: ROMWithFiles,
              Severity: Minor
              Found in src/modules/candidates/candidateExtensionCorrector.ts - About 1 hr to fix

                Function hashedReleaseCandidates has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                              releaseCandidates.map(async (releaseCandidate) => {
                                const hashedRomsWithFiles = await Promise.all(
                                  releaseCandidate.getRomsWithFiles().map(async (romWithFiles) => {
                                    const inputFile = romWithFiles.getInputFile();
                                    if (!(inputFile instanceof ArchiveFile)) {
                Severity: Minor
                Found in src/modules/candidates/candidateArchiveFileHasher.ts - About 1 hr to fix

                  Function getOrComputeArchiveChecksums has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async getOrComputeArchiveChecksums<T extends Archive>(
                      archive: T,
                      checksumBitmask: number,
                    ): Promise<ArchiveEntry<Archive>[]> {
                      // NOTE(cemmer): we're explicitly not catching ENOENT errors here, we want it to bubble up
                  Severity: Minor
                  Found in src/types/files/fileCache.ts - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language