emmercm/igir

View on GitHub

Showing 187 of 448 total issues

Function mergeParent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  private mergeParent(dat: DAT, parent: Parent, gameNamesToGames: Map<string, Game>): Game[] {
    let games = parent.getGames();

    // Sanitization
    games = games.map((game) =>
Severity: Minor
Found in src/modules/dats/datMergerSplitter.ts - About 45 mins 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 findFiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  findFiles(file: File | ROM): File[] | undefined {
    const sha256 = file.sha256?.replace(/[^0-9a-f]/gi, '');
    if (sha256 && this.sha256.has(sha256)) {
      return this.sha256.get(sha256);
    }
Severity: Minor
Found in src/types/indexedFiles.ts - About 45 mins 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 parseDatFile has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 fromFilePoly has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  static async fromFilePoly(inputRomFile: File, patchFile: FilePoly): Promise<PPFHeader> {
    const header = (await patchFile.readNext(5)).toString();
    if (!header.startsWith(PPFHeader.FILE_SIGNATURE.toString())) {
      throw new ExpectedError(`PPF patch header is invalid: ${patchFile.getPathLike()}`);
    }
Severity: Minor
Found in src/types/patches/ppfPatch.ts - About 45 mins 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 fromFilePoly has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 addWaitingMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  addWaitingMessage(waitingMessage: string): void {
    if (!this.singleBarFormatted) {
      return;
    }
    this.waitingMessages.set(waitingMessage, TimePoly.hrtimeMillis());
Severity: Minor
Found in src/console/progressBarCli.ts - About 45 mins 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 globPath has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 sanitizeDat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private sanitizeDat(dat: DAT): DAT {
    const games = dat.getGames().map((game) => {
      const roms = game
        .getRoms()
        // Games have to have at least one ROM with a non-empty checksum
Severity: Minor
Found in src/modules/dats/datScanner.ts - About 35 mins 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 parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  parse(argv: string[]): Options {
    const groupRomInput = 'ROM input options:';
    const groupDatInput = 'DAT input options:';
    const groupPatchInput = 'Patch input options:';
    const groupRomOutputPath = 'ROM output path options (processed in order):';
Severity: Minor
Found in src/modules/argumentsParser.ts - About 35 mins 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 preferLanguagesSort has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private preferLanguagesSort(a: ReleaseCandidate, b: ReleaseCandidate): number {
    const preferLanguages = this.options.getPreferLanguages();
    if (preferLanguages.length === 0) {
      return 0;
    }
Severity: Minor
Found in src/modules/candidates/candidatePreferer.ts - About 35 mins 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 getRegions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  getRegions(): string[] {
    const releaseRegions = this.getReleases().map((release) => release.getRegion().toUpperCase());
    if (releaseRegions.length > 0) {
      return releaseRegions;
    }
Severity: Minor
Found in src/types/dats/game.ts - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static async applyPatch(
    patchFile: FilePoly,
    targetFile: FilePoly,
    offsetSize: number,
    eofString: string,
Severity: Minor
Found in src/types/patches/ipsPatch.ts - About 35 mins 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 mv has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  static async mv(oldPath: string, newPath: string, attempt = 1): Promise<void> {
    try {
      return await fs.promises.rename(oldPath, newPath);
    } catch (error) {
      // These are the same error codes that `graceful-fs` catches
Severity: Minor
Found in src/polyfill/fsPoly.ts - About 35 mins 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 getHelpWidth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static getHelpWidth(argv: string[]): number {
    // Look for --help/-h with a numerical value
    for (let i = 0; i < argv.length; i += 1) {
      if (argv[i].toLowerCase() === '--help' || argv[i].toLowerCase() === '-h') {
        const helpFlagVal = Number.parseInt(argv[i + 1], 10);
Severity: Minor
Found in src/modules/argumentsParser.ts - About 35 mins 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 parseQuotedString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private parseQuotedString(): string {
    if (this.contents.charAt(this.pos) !== '"') {
      throw new ExpectedError('invalid quoted string');
    }
    this.pos += 1;
Severity: Minor
Found in src/types/dats/cmpro/cmProParser.ts - About 35 mins 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 archiveEntryPriority has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static archiveEntryPriority(file: File): number {
    if (!(file instanceof ArchiveEntry)) {
      return 0;
    }
    if (file.getArchive() instanceof Zip) {
Severity: Minor
Found in src/modules/roms/romIndexer.ts - About 35 mins 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 parseGdi has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 extractEntryToStreamCached has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private async extractEntryToStreamCached<T>(
    entryPath: string,
    callback: (stream: Readable) => Promise<T> | T,
  ): Promise<T> {
    await this.tempSingletonMutex.runExclusive(async () => {
Severity: Minor
Found in src/types/files/archives/chd/chd.ts - About 35 mins 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 sanitizeGlobPattern has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static async sanitizeGlobPattern(globPattern: string): Promise<string> {
    const pathsSplit = globPattern.split(/[\\/]/);
    for (let i = 0; i < pathsSplit.length; i += 1) {
      const subPath = pathsSplit.slice(0, i + 1).join('/');
      if (subPath !== '' && !(await fsPoly.exists(subPath))) {
Severity: Minor
Found in src/types/options.ts - About 35 mins 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

Avoid too many return statements within this function.
Open

      return GameType.HOMEBREW;
Severity: Major
Found in src/types/dats/game.ts - About 30 mins to fix
    Severity
    Category
    Status
    Source
    Language