emmercm/igir

View on GitHub

Showing 187 of 448 total issues

Function getGameType has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  getGameType(): GameType {
    // NOTE(cemmer): priority here matters!
    if (this.isBios()) {
      return GameType.BIOS;
    }
Severity: Minor
Found in src/types/dats/game.ts - About 3 hrs 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 fromFiles has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static fromFiles(files: File[]): IndexedFiles {
    const crc32RawMap = new Map<string, File[]>();
    const crc32WithoutHeaderMap = new Map<string, File[]>();
    const md5RawMap = new Map<string, File[]>();
    const md5WithoutHeaderMap = new Map<string, File[]>();
Severity: Major
Found in src/types/indexedFiles.ts - About 3 hrs to fix

    Function entryOf has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static async entryOf<A extends Archive>(
        archiveEntryProps: ArchiveEntryProps<A>,
        checksumBitmask: number = ChecksumBitmask.NONE,
      ): Promise<ArchiveEntry<A>> {
        let finalSize = archiveEntryProps.size;
    Severity: Major
    Found in src/types/files/archives/archiveEntry.ts - About 3 hrs to fix

      Function fileOf has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static async fileOf(
          fileProps: FileProps,
          checksumBitmask: number = ChecksumBitmask.NONE,
        ): Promise<File> {
          let finalSize = fileProps.size;
      Severity: Major
      Found in src/types/files/file.ts - About 2 hrs to fix

        Function getGameType has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getGameType(): GameType {
            // NOTE(cemmer): priority here matters!
            if (this.isBios()) {
              return GameType.BIOS;
            }
        Severity: Major
        Found in src/types/dats/game.ts - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                if (
                  (!finalCrcWithHeader && checksumBitmask & ChecksumBitmask.CRC32) ||
                  (!finalMd5WithHeader && checksumBitmask & ChecksumBitmask.MD5) ||
                  (!finalSha1WithHeader && checksumBitmask & ChecksumBitmask.SHA1) ||
                  (!finalSha256WithHeader && checksumBitmask & ChecksumBitmask.SHA256)
          Severity: Critical
          Found in src/types/files/file.ts - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                  if (
                    (!finalCrcWithHeader && checksumBitmask & ChecksumBitmask.CRC32) ||
                    (!finalMd5WithHeader && checksumBitmask & ChecksumBitmask.MD5) ||
                    (!finalSha1WithHeader && checksumBitmask & ChecksumBitmask.SHA1) ||
                    (!finalSha256WithHeader && checksumBitmask & ChecksumBitmask.SHA256)
            Severity: Critical
            Found in src/types/files/archives/archiveEntry.ts - About 2 hrs to fix

              Function clean has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async clean(dirsToClean: string[], filesToExclude: File[]): Promise<string[]> {
                  // If nothing was written, then don't clean anything
                  if (filesToExclude.length === 0) {
                    this.progressBar.logTrace('no files were written, not cleaning output');
                    return [];
              Severity: Major
              Found in src/modules/directoryCleaner.ts - About 2 hrs to fix

                Function generate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async generate(
                    scannedRomFiles: File[],
                    cleanedOutputFiles: string[],
                    datStatuses: DATStatus[],
                  ): Promise<void> {
                Severity: Major
                Found in src/modules/reportGenerator.ts - About 2 hrs to fix

                  Function validate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    validate(dat: DAT, parentsToCandidates: Map<Parent, ReleaseCandidate[]>): string[] {
                      if (parentsToCandidates.size === 0) {
                        this.progressBar.logTrace(
                          `${dat.getNameShort()}: no parents to validate merged & split ROM sets for`,
                        );
                  Severity: Major
                  Found in src/modules/candidates/candidateMergeSplitValidator.ts - About 2 hrs to fix

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

                      async create(
                        originalDat: DAT,
                        parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
                      ): Promise<string | undefined> {
                        if (!this.options.shouldFixdat()) {
                    Severity: Major
                    Found in src/modules/fixdatCreator.ts - About 2 hrs to fix

                      Function games has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          const games = cmproDatGames.flatMap((game) => {
                            const gameName = game.name ?? game.comment;
                      
                            let gameRoms: ROMProps[] = [];
                            if (game.rom) {
                      Severity: Major
                      Found in src/modules/dats/datScanner.ts - About 2 hrs to fix

                        Function addArchiveEntries has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private static async addArchiveEntries(
                            zipFile: Archiver,
                            inputToOutput: [File, ArchiveEntry<Zip>][],
                          ): Promise<void> {
                            let zipFileError: Error | undefined;
                        Severity: Major
                        Found in src/types/files/archives/zip.ts - About 2 hrs to fix

                          Function parseXmlDat has 54 lines of code (exceeds 25 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: Major
                          Found in src/modules/dats/datScanner.ts - About 2 hrs to fix

                            Function hashArchiveFiles has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              private async hashArchiveFiles(
                                dat: DAT,
                                parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
                              ): Promise<Map<Parent, ReleaseCandidate[]>> {
                                return new Map(
                            Severity: Major
                            Found in src/modules/candidates/candidateArchiveFileHasher.ts - About 2 hrs to fix

                              Function toCsv has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                async toCsv(options: Options): Promise<string> {
                                  const foundReleaseCandidates = DATStatus.getValuesForAllowedTypes(
                                    options,
                                    this.foundRomTypesToReleaseCandidates,
                                  );
                              Severity: Minor
                              Found in src/types/datStatus.ts - About 2 hrs 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 clean has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                async clean(dirsToClean: string[], filesToExclude: File[]): Promise<string[]> {
                                  // If nothing was written, then don't clean anything
                                  if (filesToExclude.length === 0) {
                                    this.progressBar.logTrace('no files were written, not cleaning output');
                                    return [];
                              Severity: Minor
                              Found in src/modules/directoryCleaner.ts - About 2 hrs 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 a Cognitive Complexity of 16 (exceeds 5 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 2 hrs 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 validate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                validate(dat: DAT, parentsToCandidates: Map<Parent, ReleaseCandidate[]>): string[] {
                                  if (parentsToCandidates.size === 0) {
                                    this.progressBar.logTrace(
                                      `${dat.getNameShort()}: no parents to validate merged & split ROM sets for`,
                                    );
                              Severity: Minor
                              Found in src/modules/candidates/candidateMergeSplitValidator.ts - About 2 hrs 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 constructor has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                constructor(
                                  dat: DAT,
                                  options: Options,
                                  parentsToReleaseCandidates: Map<Parent, ReleaseCandidate[]>,
                                ) {
                              Severity: Minor
                              Found in src/types/datStatus.ts - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language