emmercm/igir

View on GitHub

Showing 444 of 448 total issues

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

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

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

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

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

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

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

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

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

                stream.on('data', (chunk) => {
                  chunks.push(Buffer.from(chunk));
          
                  // Stop reading when we get enough data, trigger a 'close' event
                  if (chunks.reduce((sum, buff) => sum + buff.length, 0) >= end) {
          Severity: Major
          Found in src/types/files/romHeader.ts and 2 other locations - About 2 hrs to fix
          src/types/files/fileSignature.ts on lines 310..318
          src/types/patches/patchFactory.ts on lines 101..109

          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 82.

          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

                stream.on('data', (chunk) => {
                  chunks.push(Buffer.from(chunk));
          
                  // Stop reading when we get enough data, trigger a 'close' event
                  if (chunks.reduce((sum, buff) => sum + buff.length, 0) >= length) {
          Severity: Major
          Found in src/types/patches/patchFactory.ts and 2 other locations - About 2 hrs to fix
          src/types/files/fileSignature.ts on lines 310..318
          src/types/files/romHeader.ts on lines 103..111

          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 82.

          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

                stream.on('data', (chunk) => {
                  chunks.push(Buffer.from(chunk));
          
                  // Stop reading when we get enough data, trigger a 'close' event
                  if (chunks.reduce((sum, buff) => sum + buff.length, 0) >= end) {
          Severity: Major
          Found in src/types/files/fileSignature.ts and 2 other locations - About 2 hrs to fix
          src/types/files/romHeader.ts on lines 103..111
          src/types/patches/patchFactory.ts on lines 101..109

          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 82.

          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

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

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

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

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

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

                private parseXmlDat(datFile: File, fileContents: string): DAT | undefined {
                  this.progressBar.logTrace(
                    `${datFile.toString()}: attempting to parse ${fsPoly.sizeReadable(fileContents.length)} of XML`,
                  );
              
              
              Severity: Major
              Found in src/modules/dats/datScanner.ts - About 2 hrs to fix

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

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

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

                      this.progressBar.logTrace(
                        `${newDat.getNameShort()}: merged/split to ${newDat.getGames().length.toLocaleString()} game${newDat.getGames().length !== 1 ? 's' : ''}`,
                      );
                  Severity: Major
                  Found in src/modules/dats/datMergerSplitter.ts and 3 other locations - About 2 hrs to fix
                  src/modules/dats/datMergerSplitter.ts on lines 48..50
                  src/modules/dats/datParentInferrer.ts on lines 34..36
                  src/modules/dats/datParentInferrer.ts on lines 58..60

                  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 78.

                  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

                      this.progressBar.logTrace(
                        `${dat.getNameShort()}: inferring parents for ${dat.getGames().length.toLocaleString()} game${dat.getGames().length !== 1 ? 's' : ''}`,
                      );
                  Severity: Major
                  Found in src/modules/dats/datParentInferrer.ts and 3 other locations - About 2 hrs to fix
                  src/modules/dats/datMergerSplitter.ts on lines 48..50
                  src/modules/dats/datMergerSplitter.ts on lines 58..60
                  src/modules/dats/datParentInferrer.ts on lines 58..60

                  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 78.

                  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

                    getExtension(): string {
                      for (const ext of ZipX.getExtensions()) {
                        if (this.getFilePath().toLowerCase().endsWith(ext)) {
                          return ext;
                        }
                  Severity: Major
                  Found in src/types/files/archives/sevenZip/zipX.ts and 1 other location - About 2 hrs to fix
                  src/types/files/archives/tar.ts on lines 23..30

                  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 78.

                  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

                      this.progressBar.logTrace(
                        `${dat.getNameShort()}: merging & splitting ${dat.getGames().length.toLocaleString()} game${dat.getGames().length !== 1 ? 's' : ''}`,
                      );
                  Severity: Major
                  Found in src/modules/dats/datMergerSplitter.ts and 3 other locations - About 2 hrs to fix
                  src/modules/dats/datMergerSplitter.ts on lines 58..60
                  src/modules/dats/datParentInferrer.ts on lines 34..36
                  src/modules/dats/datParentInferrer.ts on lines 58..60

                  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 78.

                  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

                      this.progressBar.logTrace(
                        `${inferredDat.getNameShort()}: grouped to ${inferredDat.getParents().length.toLocaleString()} parent${inferredDat.getParents().length !== 1 ? 's' : ''}`,
                      );
                  Severity: Major
                  Found in src/modules/dats/datParentInferrer.ts and 3 other locations - About 2 hrs to fix
                  src/modules/dats/datMergerSplitter.ts on lines 48..50
                  src/modules/dats/datMergerSplitter.ts on lines 58..60
                  src/modules/dats/datParentInferrer.ts on lines 34..36

                  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 78.

                  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

                    getExtension(): string {
                      for (const ext of Tar.getExtensions()) {
                        if (this.getFilePath().toLowerCase().endsWith(ext)) {
                          return ext;
                        }
                  Severity: Major
                  Found in src/types/files/archives/tar.ts and 1 other location - About 2 hrs to fix
                  src/types/files/archives/sevenZip/zipX.ts on lines 16..23

                  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 78.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language