emmercm/igir

View on GitHub

Showing 444 of 448 total issues

File has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

@Exclude()
export default class File implements FileProps {
  readonly filePath: string;

  @Expose()
Severity: Minor
Found in src/types/files/file.ts - About 5 hrs to fix

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

        while (this.contents.charAt(this.pos) !== ')') {
          const tag = this.parseTag();
          const value = this.parseValue();
    
          const existing = result[tag];
    Severity: Major
    Found in src/types/dats/cmpro/cmProParser.ts and 1 other location - About 4 hrs to fix
    src/types/dats/cmpro/cmProParser.ts on lines 90..106

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

    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

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

        while (this.pos < this.contents.length) {
          const tag = this.parseTag();
          const value = this.parseValue();
    
          const existing = result[tag];
    Severity: Major
    Found in src/types/dats/cmpro/cmProParser.ts and 1 other location - About 4 hrs to fix
    src/types/dats/cmpro/cmProParser.ts on lines 123..139

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

    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

        [
          ['debug', 'debug ROMs'],
          ['demo', 'demo ROMs'],
          ['beta', 'beta ROMs'],
          ['sample', 'sample ROMs'],
    Severity: Major
    Found in src/modules/argumentsParser.ts and 1 other location - About 4 hrs to fix
    src/modules/argumentsParser.ts on lines 682..699

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

    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

        [
          ['bios', 'BIOS files'],
          ['device', 'MAME devies'],
          ['unlicensed', 'unlicensed ROMs'],
        ].forEach(([key, description]) => {
    Severity: Major
    Found in src/modules/argumentsParser.ts and 1 other location - About 4 hrs to fix
    src/modules/argumentsParser.ts on lines 705..729

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

    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

      constructor(options: Options, progressBar: ProgressBar, fileFactory: FileFactory) {
        super(progressBar, CandidateExtensionCorrector.name);
        this.options = options;
        this.fileFactory = fileFactory;
    
    
    Severity: Major
    Found in src/modules/candidates/candidateExtensionCorrector.ts and 1 other location - About 4 hrs to fix
    src/modules/candidates/candidateArchiveFileHasher.ts on lines 23..32

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

    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

      constructor(options: Options, progressBar: ProgressBar, fileFactory: FileFactory) {
        super(progressBar, CandidateArchiveFileHasher.name);
        this.options = options;
        this.fileFactory = fileFactory;
    
    
    Severity: Major
    Found in src/modules/candidates/candidateArchiveFileHasher.ts and 1 other location - About 4 hrs to fix
    src/modules/candidates/candidateExtensionCorrector.ts on lines 31..40

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

    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 mergeParent has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private mergeParent(dat: DAT, parent: Parent, gameNamesToGames: Map<string, Game>): Game[] {
        let games = parent.getGames();
    
        // Sanitization
        games = games.map((game) =>
    Severity: Major
    Found in src/modules/dats/datMergerSplitter.ts - About 4 hrs to fix

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

          yargsParser
            .option('single', {
              group: groupRomPriority,
              alias: 's',
              description:
      Severity: Major
      Found in src/modules/argumentsParser.ts and 3 other locations - About 3 hrs to fix
      src/modules/argumentsParser.ts on lines 184..662
      src/modules/argumentsParser.ts on lines 184..681
      src/modules/argumentsParser.ts on lines 731..806

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

      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

          yargsParser
            .option('input', {
              group: groupRomInput,
              alias: 'i',
              description: 'Path(s) to ROM files or archives (supports globbing)',
      Severity: Major
      Found in src/modules/argumentsParser.ts and 3 other locations - About 3 hrs to fix
      src/modules/argumentsParser.ts on lines 184..681
      src/modules/argumentsParser.ts on lines 731..786
      src/modules/argumentsParser.ts on lines 731..806

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

      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 stripGameVariants has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private static stripGameVariants(name: string): string {
          return (
            name
              // ***** Retail types *****
              .replace(/\(Alt( [a-z0-9. ]*)?\)/i, '')
      Severity: Major
      Found in src/modules/dats/datParentInferrer.ts - About 3 hrs to fix

        Function fileOf has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

          static async fileOf(
            fileProps: FileProps,
            checksumBitmask: number = ChecksumBitmask.NONE,
          ): Promise<File> {
            let finalSize = fileProps.size;
        Severity: Minor
        Found in src/types/files/file.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 constructor has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor(options?: OptionsProps) {
            this.commands = options?.commands ?? [];
        
            this.input = options?.input ?? [];
            this.inputExclude = options?.inputExclude ?? [];
        Severity: Major
        Found in src/types/options.ts - About 3 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

            File datStatus.ts has 311 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { writeToString } from '@fast-csv/format';
            import chalk, { ChalkInstance } from 'chalk';
            
            import ArrayPoly from '../polyfill/arrayPoly.js';
            import DAT from './dats/dat.js';
            Severity: Minor
            Found in src/types/datStatus.ts - About 3 hrs to fix

              Function entryOf has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                static async entryOf<A extends Archive>(
                  archiveEntryProps: ArchiveEntryProps<A>,
                  checksumBitmask: number = ChecksumBitmask.NONE,
                ): Promise<ArchiveEntry<A>> {
                  let finalSize = archiveEntryProps.size;
              Severity: Minor
              Found in src/types/files/archives/archiveEntry.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

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

                private static getEtaFormattedDays(secondsRounded: number): string {
                  const hours = Math.floor((secondsRounded % 86_400) / 3600);
                  if (hours > 0) {
                    return `${Math.floor(secondsRounded / 86_400)}d${hours}h`;
                  }
              Severity: Major
              Found in src/console/singleBarFormatted.ts and 1 other location - About 3 hrs to fix
              src/console/singleBarFormatted.ts on lines 201..207

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

              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

                private static getEtaFormattedHours(secondsRounded: number): string {
                  const minutes = Math.floor((secondsRounded % 3600) / 60);
                  if (minutes > 0) {
                    return `${Math.floor(secondsRounded / 3600)}h${minutes}m`;
                  }
              Severity: Major
              Found in src/console/singleBarFormatted.ts and 1 other location - About 3 hrs to fix
              src/console/singleBarFormatted.ts on lines 193..199

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

              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 extractEntryToStreamCached has 84 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private async extractEntryToStreamCached<T>(
                  entryPath: string,
                  callback: (stream: Readable) => Promise<T> | T,
                ): Promise<T> {
                  await this.tempSingletonMutex.runExclusive(async () => {
              Severity: Major
              Found in src/types/files/archives/chd/chd.ts - About 3 hrs to fix

                Function buildPatchedParentsForReleaseCandidate has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private async buildPatchedParentsForReleaseCandidate(
                    dat: DAT,
                    unpatchedReleaseCandidate: ReleaseCandidate,
                    crcToPatches: Map<string, Patch[]>,
                  ): Promise<[Parent, ReleaseCandidate[]][] | undefined> {
                Severity: Major
                Found in src/modules/candidates/candidatePatchGenerator.ts - About 3 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language