emmercm/igir

View on GitHub

Showing 187 of 448 total issues

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 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 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 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 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 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 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 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 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 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 getGames has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      getGames(): Game[] {
                        if (Array.isArray(this.game)) {
                          if (this.game.length > 0) {
                            return this.game;
                          }
                    Severity: Minor
                    Found in src/types/dats/logiqx/logiqxDat.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 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 infer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      infer(dat: DAT): DAT {
                        if (dat.hasParentCloneInfo() && !this.options.getDatIgnoreParentClone()) {
                          this.progressBar.logTrace(`${dat.getNameShort()}: DAT has parent/clone info, skipping`);
                          return dat;
                        }
                    Severity: Minor
                    Found in src/modules/dats/datParentInferrer.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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public parse(): DATProps {
                        this.pos = 0;
                    
                        const result: CMProObject = {};
                        while (this.pos < this.contents.length) {
                    Severity: Minor
                    Found in src/types/dats/cmpro/cmProParser.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