emmercm/igir

View on GitHub
src/modules/dats/datScanner.ts

Summary

Maintainability
F
6 days
Test Coverage

File datScanner.ts has 484 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as child_process from 'node:child_process';
import path from 'node:path';

import { parse } from '@fast-csv/parse';

Severity: Minor
Found in src/modules/dats/datScanner.ts - About 7 hrs to fix

    Function parseCmproDat has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private parseCmproDat(datFile: File, fileContents: string): DAT | undefined {
        /**
         * Validation that this might be a CMPro file.
         */
        if (fileContents.match(/^(clrmamepro|game|resource) \(\r?\n(\s.+\r?\n)+\)$/m) === null) {
    Severity: Major
    Found in src/modules/dats/datScanner.ts - About 3 hrs to fix

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

        private parseCmproDat(datFile: File, fileContents: string): DAT | undefined {
          /**
           * Validation that this might be a CMPro file.
           */
          if (fileContents.match(/^(clrmamepro|game|resource) \(\r?\n(\s.+\r?\n)+\)$/m) === null) {
      Severity: Minor
      Found in src/modules/dats/datScanner.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 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 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 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 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 parseSourceMaterialDatabase has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private async parseSourceMaterialDatabase(
                datFile: File,
                fileContents: string,
              ): Promise<DAT | undefined> {
                this.progressBar.logTrace(`${datFile.toString()}: attempting to parse SMDB`);
            Severity: Minor
            Found in src/modules/dats/datScanner.ts - About 1 hr to fix

              Function parseMameListxml has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private async parseMameListxml(mameExecutable: File): Promise<DAT | undefined> {
                  this.progressBar.logTrace(
                    `${mameExecutable.toString()}: attempting to get ListXML from MAME executable`,
                  );
              
              
              Severity: Minor
              Found in src/modules/dats/datScanner.ts - About 1 hr to fix

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

                  private async downloadDats(datFiles: File[]): Promise<File[]> {
                    if (!datFiles.some((datFile) => datFile.isURL())) {
                      return datFiles;
                    }
                
                
                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 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 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 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

                      Avoid too many return statements within this function.
                      Open

                              return SoftwareListsDAT.fromObject(datObject.softwarelists);
                      Severity: Major
                      Found in src/modules/dats/datScanner.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return undefined;
                        Severity: Major
                        Found in src/modules/dats/datScanner.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return undefined;
                          Severity: Major
                          Found in src/modules/dats/datScanner.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return undefined;
                            Severity: Major
                            Found in src/modules/dats/datScanner.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return SoftwareListDAT.fromObject(datObject.softwarelist);
                              Severity: Major
                              Found in src/modules/dats/datScanner.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return undefined;
                                Severity: Major
                                Found in src/modules/dats/datScanner.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return false;
                                  Severity: Major
                                  Found in src/modules/dats/datScanner.ts - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return undefined;
                                    Severity: Major
                                    Found in src/modules/dats/datScanner.ts - About 30 mins to fix

                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                      Open

                                            const roms = gameRoms.map(
                                              (entry) =>
                                                new ROM({
                                                  name: entry.name ?? '',
                                                  size: Number.parseInt(entry.size ?? '0', 10),
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 1 other location - About 2 hrs to fix
                                      src/modules/dats/datScanner.ts on lines 408..417

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 86.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                      Open

                                            const disks = gameDisks.map(
                                              (entry) =>
                                                new Disk({
                                                  name: entry.name ?? '',
                                                  size: Number.parseInt(entry.size ?? '0', 10),
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 1 other location - About 2 hrs to fix
                                      src/modules/dats/datScanner.ts on lines 389..398

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 86.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                      Open

                                          if (datObject.softwarelist) {
                                            try {
                                              return SoftwareListDAT.fromObject(datObject.softwarelist);
                                            } catch (error) {
                                              this.progressBar.logTrace(
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 3 other locations - About 2 hrs to fix
                                      src/modules/dats/datScanner.ts on lines 291..298
                                      src/modules/dats/datScanner.ts on lines 300..309
                                      src/modules/dats/datScanner.ts on lines 311..320

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 77.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                      Open

                                          if (datObject.softwarelists) {
                                            try {
                                              return SoftwareListsDAT.fromObject(datObject.softwarelists);
                                            } catch (error) {
                                              this.progressBar.logTrace(
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 3 other locations - About 2 hrs to fix
                                      src/modules/dats/datScanner.ts on lines 291..298
                                      src/modules/dats/datScanner.ts on lines 300..309
                                      src/modules/dats/datScanner.ts on lines 322..331

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 77.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                      Open

                                          if (datObject.mame) {
                                            try {
                                              return MameDAT.fromObject(datObject.mame);
                                            } catch (error) {
                                              this.progressBar.logTrace(
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 3 other locations - About 2 hrs to fix
                                      src/modules/dats/datScanner.ts on lines 291..298
                                      src/modules/dats/datScanner.ts on lines 311..320
                                      src/modules/dats/datScanner.ts on lines 322..331

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 77.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                      Open

                                          if (datObject.datafile) {
                                            try {
                                              return LogiqxDAT.fromObject(datObject.datafile);
                                            } catch (error) {
                                              this.progressBar.logTrace(`${datFile.toString()}: failed to parse DAT object: ${error}`);
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 3 other locations - About 2 hrs to fix
                                      src/modules/dats/datScanner.ts on lines 300..309
                                      src/modules/dats/datScanner.ts on lines 311..320
                                      src/modules/dats/datScanner.ts on lines 322..331

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 77.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 3 locations. Consider refactoring.
                                      Open

                                            if (game.rom) {
                                              if (Array.isArray(game.rom)) {
                                                gameRoms = game.rom;
                                              } else {
                                                gameRoms = [game.rom];
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 2 other locations - About 1 hr to fix
                                      src/modules/dats/datScanner.ts on lines 370..376
                                      src/modules/dats/datScanner.ts on lines 401..407

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 58.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 3 locations. Consider refactoring.
                                      Open

                                            if (game.disk) {
                                              if (Array.isArray(game.disk)) {
                                                gameDisks = game.disk;
                                              } else {
                                                gameDisks = [game.disk];
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 2 other locations - About 1 hr to fix
                                      src/modules/dats/datScanner.ts on lines 370..376
                                      src/modules/dats/datScanner.ts on lines 382..388

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 58.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                      Open

                                          const size = dat
                                            .getGames()
                                            .flatMap((game) => game.getRoms())
                                            .reduce((sum, rom) => sum + rom.getSize(), 0);
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 1 other location - About 1 hr to fix
                                      src/modules/dats/datFilter.ts on lines 55..58

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 58.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 3 locations. Consider refactoring.
                                      Open

                                          if (cmproDat.game) {
                                            if (Array.isArray(cmproDat.game)) {
                                              cmproDatGames = cmproDat.game;
                                            } else {
                                              cmproDatGames = [cmproDat.game];
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 2 other locations - About 1 hr to fix
                                      src/modules/dats/datScanner.ts on lines 382..388
                                      src/modules/dats/datScanner.ts on lines 401..407

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 58.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 8 locations. Consider refactoring.
                                      Open

                                          this.progressBar.logTrace(
                                            `found ${datFilePaths.length.toLocaleString()} DAT file${datFilePaths.length !== 1 ? 's' : ''}`,
                                          );
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 7 other locations - About 55 mins to fix
                                      src/modules/dats/datScanner.ts on lines 119..121
                                      src/modules/directoryCleaner.ts on lines 57..59
                                      src/modules/directoryCleaner.ts on lines 82..84
                                      src/modules/movedRomDeleter.ts on lines 59..61
                                      src/modules/patchScanner.ts on lines 30..32
                                      src/modules/roms/romIndexer.ts on lines 33..35
                                      src/modules/roms/romScanner.ts on lines 31..33

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 53.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 8 locations. Consider refactoring.
                                      Open

                                          this.progressBar.logTrace(
                                            `parsing ${datFiles.length.toLocaleString()} DAT file${datFiles.length !== 1 ? 's' : ''}`,
                                          );
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 7 other locations - About 55 mins to fix
                                      src/modules/dats/datScanner.ts on lines 61..63
                                      src/modules/directoryCleaner.ts on lines 57..59
                                      src/modules/directoryCleaner.ts on lines 82..84
                                      src/modules/movedRomDeleter.ts on lines 59..61
                                      src/modules/patchScanner.ts on lines 30..32
                                      src/modules/roms/romIndexer.ts on lines 33..35
                                      src/modules/roms/romScanner.ts on lines 31..33

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 53.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 8 locations. Consider refactoring.
                                      Open

                                          if (rows.length === 0) {
                                            this.progressBar.logTrace(`${datFile.toString()}: failed to parse SMDB, file has no rows`);
                                            return undefined;
                                          }
                                      Severity: Major
                                      Found in src/modules/dats/datScanner.ts and 7 other locations - About 40 mins to fix
                                      src/modules/candidates/candidateArchiveFileHasher.ts on lines 41..44
                                      src/modules/candidates/candidateCombiner.ts on lines 36..39
                                      src/modules/candidates/candidateExtensionCorrector.ts on lines 49..52
                                      src/modules/candidates/candidatePatchGenerator.ts on lines 33..36
                                      src/modules/candidates/candidatePostProcessor.ts on lines 29..32
                                      src/modules/candidates/candidatePreferer.ts on lines 30..33
                                      src/modules/fixdatCreator.ts on lines 56..61

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 49.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 3 locations. Consider refactoring.
                                      Open

                                        constructor(options: Options, progressBar: ProgressBar, fileFactory: FileFactory) {
                                          super(options, progressBar, fileFactory, DATScanner.name);
                                        }
                                      Severity: Minor
                                      Found in src/modules/dats/datScanner.ts and 2 other locations - About 30 mins to fix
                                      src/modules/patchScanner.ts on lines 15..17
                                      src/modules/roms/romScanner.ts on lines 13..15

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 45.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      There are no issues that match your filters.

                                      Category
                                      Status