emmercm/igir

View on GitHub

Showing 187 of 448 total issues

Function romsWithFiles has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          unpatchedReleaseCandidate.getRomsWithFiles().map(async (romWithFiles) => {
            // Apply the new filename
            let rom = romWithFiles.getRom();
            let inputFile = romWithFiles.getInputFile();
            let outputFile = romWithFiles.getOutputFile();
Severity: Minor
Found in src/modules/candidates/candidatePatchGenerator.ts - About 1 hr to fix

    Function parseDatFile has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private async parseDatFile(datFile: File): Promise<DAT | undefined> {
        let dat: DAT | undefined;
    
        if (
          !dat &&
    Severity: Minor
    Found in src/modules/dats/datScanner.ts - About 1 hr to fix

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

        async process(inputRomFiles: File[]): Promise<File[]> {
          if (inputRomFiles.length === 0) {
            return inputRomFiles;
          }
      
      
      Severity: Minor
      Found in src/modules/roms/romHeaderProcessor.ts - About 1 hr to fix

        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

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

              const addCommands = (yargsObj: Argv, previousCommands: string[] = []): Argv => {
                commands
                  // Don't allow/show duplicate commands, i.e. don't give `igir copy copy` as an option
                  .filter(([command]) => !previousCommands.includes(command))
                  // Don't allow/show conflicting commands, i.e. don't give `igir copy move` as an option
          Severity: Minor
          Found in src/modules/argumentsParser.ts - About 1 hr to fix

            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

              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

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

                            Function parseGdi has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              private static async parseGdi<T extends Archive>(
                                archive: T,
                                gdiFilePath: string,
                                binRawFilePaths: string[],
                                checksumBitmask: number,
                            Severity: Minor
                            Found in src/types/files/archives/chd/chdGdiParser.ts - About 1 hr to fix

                              Function parseXmlDat has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                                private parseXmlDat(datFile: File, fileContents: string): DAT | undefined {
                                  this.progressBar.logTrace(
                                    `${datFile.toString()}: attempting to parse ${fsPoly.sizeReadable(fileContents.length)} of XML`,
                                  );
                              
                              
                              Severity: Minor
                              Found in src/modules/dats/datScanner.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 trashOrDelete has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                private async trashOrDelete(filePaths: string[]): Promise<void> {
                                  // Prefer recycling...
                                  for (let i = 0; i < filePaths.length; i += Defaults.OUTPUT_CLEANER_BATCH_SIZE) {
                                    const filePathsChunk = filePaths.slice(i, i + Defaults.OUTPUT_CLEANER_BATCH_SIZE);
                                    this.progressBar.logInfo(
                              Severity: Minor
                              Found in src/modules/directoryCleaner.ts - About 1 hr to fix

                                Function create has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  async create(
                                    dat: DAT,
                                    parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
                                  ): Promise<string | undefined> {
                                    if (!this.options.shouldDir2Dat()) {
                                Severity: Minor
                                Found in src/modules/dir2DatCreator.ts - About 1 hr to fix

                                  Function extractAndPatchToFile has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    async extractAndPatchToFile(destinationPath: string): Promise<void> {
                                      const start = this.getFileHeader()?.getDataOffsetBytes() ?? 0;
                                      const patch = this.getPatch();
                                  
                                      // Simple case: create a file without removing its header
                                  Severity: Minor
                                  Found in src/types/files/file.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language