emmercm/igir

View on GitHub

Showing 187 of 448 total issues

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

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

            async getOrComputeFileChecksums(filePath: string, checksumBitmask: number): Promise<File> {
              // NOTE(cemmer): we're explicitly not catching ENOENT errors here, we want it to bubble up
              const stats = await FsPoly.stat(filePath);
              const cacheKey = await this.getCacheKey(filePath, undefined, ValueType.FILE_CHECKSUMS);
          
          
          Severity: Minor
          Found in src/types/files/fileCache.ts - About 1 hr to fix

            Function filesFrom has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              async filesFrom(
                filePath: string,
                fileChecksumBitmask: number = ChecksumBitmask.CRC32,
                archiveChecksumBitmask = fileChecksumBitmask,
              ): Promise<File[]> {
            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

            Function getAllowedTypes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              private static getAllowedTypes(options: Options): ROMType[] {
                return [
                  !options.getOnlyBios() && !options.getOnlyDevice() && !options.getOnlyRetail()
                    ? ROMType.GAME
                    : undefined,
            Severity: Minor
            Found in src/types/datStatus.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 missingGames has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  .flatMap((game) => {
                    let missingDependencies: string[] = [];
            
                    // Validate dependent parent was found
                    if (
            Severity: Minor
            Found in src/modules/candidates/candidateMergeSplitValidator.ts - About 1 hr to fix

              Function toConsole has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                toConsole(options: Options): string {
                  return `${DATStatus.getAllowedTypes(options)
                    .filter((type) => this.allRomTypesToGames.get(type)?.length)
                    .map((type) => {
                      const found = this.foundRomTypesToReleaseCandidates.get(type) ?? [];
              Severity: Minor
              Found in src/types/datStatus.ts - About 1 hr to fix

                Function entriesFromArchiveExtension has 31 lines of code (exceeds 25 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

                  Function merge has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    merge(dat: DAT): DAT {
                      // Don't do anything if no type provided
                      if (this.options.getMergeRoms() === undefined) {
                        this.progressBar.logTrace(
                          `${dat.getNameShort()}: no ROM merge option provided, doing nothing`,
                  Severity: Minor
                  Found in src/modules/dats/datMergerSplitter.ts - About 1 hr to fix

                    Function validateUniqueOutputPaths has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private validateUniqueOutputPaths(
                        dat: DAT,
                        parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
                      ): ReleaseCandidate[] {
                        const outputPathsToCandidates = [...parentsToCandidates.values()]
                    Severity: Minor
                    Found in src/modules/candidates/candidateValidator.ts - About 1 hr to fix

                      Function decode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        decode(
                          copyAddressesData: Buffer,
                          copyAddressesOffset: number,
                          here: number,
                          mode: number,
                      Severity: Minor
                      Found in src/types/patches/vcdiffPatch.ts - About 1 hr to fix

                        Function scanPaths has 30 lines of code (exceeds 25 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

                          Function getArchiveEntries has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            async getArchiveEntries(checksumBitmask: number): Promise<ArchiveEntry<this>[]> {
                              // https://github.com/ZJONSSON/node-unzipper/issues/280
                              // UTF-8 entry names are not decoded correctly
                              // But this is mitigated by `extractEntryToStream()` and therefore `extractEntryToFile()` both
                              //  using `unzipper.Open.file()` as well, so mangled filenames here will still extract fine
                          Severity: Minor
                          Found in src/types/files/archives/zip.ts - About 1 hr to fix

                            Function getArchiveEntriesNotCached has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              private async getArchiveEntriesNotCached(checksumBitmask: number): Promise<ArchiveEntry<this>[]> {
                                /**
                                 * WARN(cemmer): {@link _7z.list} seems to have issues with any amount of real concurrency,
                                 *  it will return no files but also no error. Try to prevent that behavior.
                                 */
                            Severity: Minor
                            Found in src/types/files/archives/sevenZip/sevenZip.ts - About 1 hr to fix

                              Function globPath has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                private static async globPath(
                                  inputPath: string,
                                  walkCallback: FsWalkCallback,
                                ): Promise<string[]> {
                                  // Windows will report that \\.\nul doesn't exist, catch it explicitly
                              Severity: Minor
                              Found in src/types/options.ts - About 1 hr to fix

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

                                              releaseCandidates.map(async (releaseCandidate) => {
                                                const hashedRomsWithFiles = await Promise.all(
                                                  releaseCandidate.getRomsWithFiles().map(async (romWithFiles) => {
                                                    const correctedRom = await this.buildCorrectedRom(
                                                      dat,
                                Severity: Minor
                                Found in src/modules/candidates/candidateExtensionCorrector.ts - About 1 hr to fix

                                  Function downloadDats has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    private async downloadDats(datFiles: File[]): Promise<File[]> {
                                      if (!datFiles.some((datFile) => datFile.isURL())) {
                                        return datFiles;
                                      }
                                  
                                  
                                  Severity: Minor
                                  Found in src/modules/dats/datScanner.ts - About 1 hr to fix

                                    Function hash has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      async hash(
                                        dat: DAT,
                                        parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
                                      ): Promise<Map<Parent, ReleaseCandidate[]>> {
                                        if (parentsToCandidates.size === 0) {
                                    Severity: Minor
                                    Found in src/modules/candidates/candidateArchiveFileHasher.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language