emmercm/igir

View on GitHub

Showing 187 of 448 total issues

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

  private async build(
    dat: DAT,
    parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
    crcToPatches: Map<string, Patch[]>,
  ): Promise<Map<Parent, ReleaseCandidate[]>> {
Severity: Minor
Found in src/modules/candidates/candidatePatchGenerator.ts - About 1 hr to fix

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

      private sortMap(checksumsToFiles: ChecksumsToFiles): void {
        const outputDir = path.resolve(this.options.getOutputDirRoot());
        const outputDirDisk = FsPoly.diskResolved(outputDir);
    
        [...checksumsToFiles.values()].forEach((files) =>
    Severity: Minor
    Found in src/modules/roms/romIndexer.ts - About 1 hr to fix

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

        async loadFile(cacheFilePath: string): Promise<void> {
          this.cache = await new Cache<CacheValue>({
            filePath: cacheFilePath,
            fileFlushMillis: 60_000,
            saveOnExit: true,
      Severity: Minor
      Found in src/types/files/fileCache.ts - About 1 hr to fix

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

        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 27 lines of code (exceeds 25 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 1 hr to fix

          Function getEmptyDirs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private static async getEmptyDirs(dirsToClean: string | string[]): Promise<string[]> {
              if (Array.isArray(dirsToClean)) {
                return (
                  await Promise.all(
                    dirsToClean.map(async (dirToClean) => DirectoryCleaner.getEmptyDirs(dirToClean)),
          Severity: Minor
          Found in src/modules/directoryCleaner.ts - About 1 hr to fix

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

              Function shouldFilterOut has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private shouldFilterOut(dat: DAT): boolean {
                  const datNameRegex = this.options.getDatNameRegex();
                  if (datNameRegex && !datNameRegex.some((regex) => regex.test(dat.getName()))) {
                    return true;
                  }
              Severity: Minor
              Found in src/modules/dats/datScanner.ts - About 1 hr to fix

                Function parseDatFiles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private async parseDatFiles(datFiles: File[]): Promise<DAT[]> {
                    this.progressBar.logTrace(
                      `parsing ${datFiles.length.toLocaleString()} DAT file${datFiles.length !== 1 ? 's' : ''}`,
                    );
                    this.progressBar.setSymbol(ProgressBarSymbol.DAT_PARSING);
                Severity: Minor
                Found in src/modules/dats/datScanner.ts - About 1 hr to fix

                  Function constructor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    protected constructor(fileProps: FileProps) {
                      this.filePath = path.normalize(fileProps.filePath);
                      this.size = fileProps.size ?? 0;
                      this.checksumBitmask = fileProps.checksumBitmask;
                      this.crc32 = fileProps.crc32?.toLowerCase().replace(/^0x/, '').padStart(8, '0');
                  Severity: Minor
                  Found in src/types/files/file.ts - About 1 hr to fix

                    Function sortAndFilter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private sortAndFilter(
                        dat: DAT,
                        parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
                      ): Map<Parent, ReleaseCandidate[]> {
                        const output = new Map<Parent, ReleaseCandidate[]>();
                    Severity: Minor
                    Found in src/modules/candidates/candidatePreferer.ts - About 55 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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      render(force = false): void {
                        this.singleBarFormatted?.getSingleBar().update(this.payload);
                    
                        const callback = (): void => {
                          // Dequeue all log messages
                    Severity: Minor
                    Found in src/console/progressBarCli.ts - About 55 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 process has a Cognitive Complexity of 9 (exceeds 5 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 55 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 parseObject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private parseObject(): CMProObject {
                        if (this.contents.charAt(this.pos) === '(') {
                          this.pos += 1;
                        }
                        this.skipWhitespace();
                    Severity: Minor
                    Found in src/types/dats/cmpro/cmProParser.ts - About 55 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 writeCopyData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      async writeCopyData(
                        sourceFile: FilePoly,
                        targetFile: FilePoly,
                        targetWindowPosition: number,
                        size: number,
                    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 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 getEtaFormatted has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private getEtaFormatted(etaSeconds: number): string {
                        // Rate limit how often the ETA can change
                        //  Update only every 5s if the ETA is >60s
                        const elapsedMs = TimePoly.hrtimeMillis(this.lastEtaTime);
                        if (etaSeconds > 60 && elapsedMs < 5000) {
                    Severity: Minor
                    Found in src/console/singleBarFormatted.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 walk has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      static async walk(pathLike: PathLike, callback?: FsWalkCallback): Promise<string[]> {
                        let output: string[] = [];
                    
                        let entries: fs.Dirent[];
                        try {
                    Severity: Minor
                    Found in src/polyfill/fsPoly.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

                    Severity
                    Category
                    Status
                    Source
                    Language