alessandrocuzzocrea/chip-8-emulator-js

View on GitHub
src/chip8.js

Summary

Maintainability
F
2 wks
Test Coverage

Function decode has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

function decode(chip, opcode, keyboard, logger) {
  const a = (opcode >> 12) & 0xf;
  const b = (opcode >> 8) & 0xf;
  const c = (opcode >> 4) & 0xf;
  const d = opcode & 0xf;
Severity: Minor
Found in src/chip8.js - About 1 day 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

File chip8.js has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const cloneDeep = require("lodash/cloneDeep");
const values = require("lodash/values");
const range = require("lodash/range");

const consts = require("./consts");
Severity: Major
Found in src/chip8.js - About 1 day to fix

    Function decode has 193 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function decode(chip, opcode, keyboard, logger) {
      const a = (opcode >> 12) & 0xf;
      const b = (opcode >> 8) & 0xf;
      const c = (opcode >> 4) & 0xf;
      const d = opcode & 0xf;
    Severity: Major
    Found in src/chip8.js - About 7 hrs to fix

      Function decode2 has 135 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function decode2(chip, pc) {
        const opcode = fetch(chip, pc);
        const a = (opcode >> 12) & 0xf;
        const b = (opcode >> 8) & 0xf;
        const c = (opcode >> 4) & 0xf;
      Severity: Major
      Found in src/chip8.js - About 5 hrs to fix

        Function decode2 has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        function decode2(chip, pc) {
          const opcode = fetch(chip, pc);
          const a = (opcode >> 12) & 0xf;
          const b = (opcode >> 8) & 0xf;
          const c = (opcode >> 4) & 0xf;
        Severity: Minor
        Found in src/chip8.js - About 4 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 drw has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function drw(chip8, x, y, byte) {
          let vf = 0;
          const xCoord = chip8.v[x];
          const yCoord = chip8.v[y];
          const i = chip8.i;
        Severity: Minor
        Found in src/chip8.js - 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 module.exports.ldVxDT(chip, x);
        Severity: Major
        Found in src/chip8.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return module.exports.ldVxIndirectI(chip, x);
          Severity: Major
          Found in src/chip8.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return "SNE Vx, Vy";
            Severity: Major
            Found in src/chip8.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return "LD I, addr";
              Severity: Major
              Found in src/chip8.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return "LD Vx, Vy";
                Severity: Major
                Found in src/chip8.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return "ADD I, Vx";
                  Severity: Major
                  Found in src/chip8.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return module.exports.sne(chip, vx, byte);
                    Severity: Major
                    Found in src/chip8.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return "Fx29";
                      Severity: Major
                      Found in src/chip8.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return "Fx65";
                        Severity: Major
                        Found in src/chip8.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return module.exports.ldDTVx(chip, x);
                          Severity: Major
                          Found in src/chip8.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return "LD Vx, byte";
                            Severity: Major
                            Found in src/chip8.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return module.exports.se(chip, vx, byte);
                              Severity: Major
                              Found in src/chip8.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return module.exports.sknp(chip, x, keyboard.getKeys());
                                Severity: Major
                                Found in src/chip8.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return module.exports.addIVx(chip, x);
                                  Severity: Major
                                  Found in src/chip8.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                      return `Illegal opcode: ${opcode.toString(16)}`;
                                    Severity: Major
                                    Found in src/chip8.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return module.exports.skp(chip, x, keyboard.getKeys());
                                      Severity: Major
                                      Found in src/chip8.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                return "LD Vx, DT";
                                        Severity: Major
                                        Found in src/chip8.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                  return "Fx33";
                                          Severity: Major
                                          Found in src/chip8.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                    return module.exports.add(chip, vx, byte);
                                            Severity: Major
                                            Found in src/chip8.js - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                    return module.exports.drw(chip, b, c, d);
                                              Severity: Major
                                              Found in src/chip8.js - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                        return module.exports.rnd(chip, x, byte);
                                                Severity: Major
                                                Found in src/chip8.js - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                          return "SE Vx, byte";
                                                  Severity: Major
                                                  Found in src/chip8.js - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                            return module.exports.sneXY(chip, vx, vy);
                                                    Severity: Major
                                                    Found in src/chip8.js - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return module.exports.ldIndirectIVx(chip, x);
                                                      Severity: Major
                                                      Found in src/chip8.js - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return "SKNP Vx";
                                                        Severity: Major
                                                        Found in src/chip8.js - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                  return "Fx55";
                                                          Severity: Major
                                                          Found in src/chip8.js - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                    return module.exports.ldXY(chip, vx, vy);
                                                            Severity: Major
                                                            Found in src/chip8.js - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                      return "ADD Vx, byte";
                                                              Severity: Major
                                                              Found in src/chip8.js - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                        return "SNE Vx, byte";
                                                                Severity: Major
                                                                Found in src/chip8.js - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                          return module.exports.ld(chip, vx, byte);
                                                                  Severity: Major
                                                                  Found in src/chip8.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                            return module.exports.andXY(chip, vx, vy);
                                                                    Severity: Major
                                                                    Found in src/chip8.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return module.exports.ldI(chip, nnn);
                                                                      Severity: Major
                                                                      Found in src/chip8.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                return module.exports.ldB(chip, x);
                                                                        Severity: Major
                                                                        Found in src/chip8.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                  return "SKP Vx";
                                                                          Severity: Major
                                                                          Found in src/chip8.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                    return module.exports.ldFVx(chip, x);
                                                                            Severity: Major
                                                                            Found in src/chip8.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      return "AND Vx, Vy";
                                                                              Severity: Major
                                                                              Found in src/chip8.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                        return "RND Vx, byte";
                                                                                Severity: Major
                                                                                Found in src/chip8.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                          return "LD DT, Vx";
                                                                                  Severity: Major
                                                                                  Found in src/chip8.js - About 30 mins to fix

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

                                                                                    function subnXY(chip8, x, y) {
                                                                                      const difference = chip8.v[y] - chip8.v[x];
                                                                                      chip8.v[0xf] = chip8.v[y] > chip8.v[x] ? 0x01 : 0x00;
                                                                                      chip8.v[x] = difference;
                                                                                      return chip8;
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 1 other location - About 3 hrs to fix
                                                                                    src/chip8.js on lines 154..159

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

                                                                                    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

                                                                                    function subXY(chip8, x, y) {
                                                                                      const difference = chip8.v[x] - chip8.v[y];
                                                                                      chip8.v[0xf] = chip8.v[x] > chip8.v[y] ? 0x01 : 0x00;
                                                                                      chip8.v[x] = difference;
                                                                                      return chip8;
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 1 other location - About 3 hrs to fix
                                                                                    src/chip8.js on lines 168..173

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

                                                                                    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 5 locations. Consider refactoring.
                                                                                    Open

                                                                                        case 0x3:
                                                                                          {
                                                                                            // 3xkk - SE Vx, byte
                                                                                            const vx = b;
                                                                                            const byte = (c << 4) + d;
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 4 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 333..346
                                                                                    src/chip8.js on lines 348..361
                                                                                    src/chip8.js on lines 363..376
                                                                                    src/chip8.js on lines 430..444

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

                                                                                    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 5 locations. Consider refactoring.
                                                                                    Open

                                                                                        case 0xc:
                                                                                          {
                                                                                            // Cxkk - RND Vx, byte
                                                                                            const x = b;
                                                                                            const byte = (c << 4) + d;
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 4 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 318..331
                                                                                    src/chip8.js on lines 333..346
                                                                                    src/chip8.js on lines 348..361
                                                                                    src/chip8.js on lines 363..376

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

                                                                                    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 5 locations. Consider refactoring.
                                                                                    Open

                                                                                        case 0x7:
                                                                                          {
                                                                                            // "7xkk - ADD Vx, byte"
                                                                                            const vx = b;
                                                                                            const byte = (c << 4) + d;
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 4 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 318..331
                                                                                    src/chip8.js on lines 333..346
                                                                                    src/chip8.js on lines 348..361
                                                                                    src/chip8.js on lines 430..444

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

                                                                                    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 5 locations. Consider refactoring.
                                                                                    Open

                                                                                        case 0x4:
                                                                                          {
                                                                                            // 4xkk - SNE Vx, byte
                                                                                            const vx = b;
                                                                                            const byte = (c << 4) + d;
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 4 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 318..331
                                                                                    src/chip8.js on lines 348..361
                                                                                    src/chip8.js on lines 363..376
                                                                                    src/chip8.js on lines 430..444

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

                                                                                    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 5 locations. Consider refactoring.
                                                                                    Open

                                                                                        case 0x6:
                                                                                          {
                                                                                            // 6xkk - LD Vx, byte
                                                                                            const vx = b;
                                                                                            const byte = (c << 4) + d;
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 4 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 318..331
                                                                                    src/chip8.js on lines 333..346
                                                                                    src/chip8.js on lines 363..376
                                                                                    src/chip8.js on lines 430..444

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

                                                                                    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

                                                                                          if (d === 0x2) {
                                                                                            const vx = b;
                                                                                            const vy = c;
                                                                                            if (logger)
                                                                                              logger.log(
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 1 other location - About 2 hrs to fix
                                                                                    src/chip8.js on lines 403..411

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

                                                                                    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

                                                                                          if (d === 0x0) {
                                                                                            const vx = b;
                                                                                            const vy = c;
                                                                                            if (logger)
                                                                                              logger.log(
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 1 other location - About 2 hrs to fix
                                                                                    src/chip8.js on lines 390..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 88.

                                                                                    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

                                                                                        case 0xa:
                                                                                          {
                                                                                            // "Annn - LD I, addr"
                                                                                            const nnn = (b << 8) + (c << 4) + d;
                                                                                            if (logger) logger.log(`Annn - LD I, addr: nnn=${nnn.toString(16)}`);
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 2 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 300..307
                                                                                    src/chip8.js on lines 309..316

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

                                                                                    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

                                                                                        case 0x2:
                                                                                          {
                                                                                            // 2nnn - CALL addr
                                                                                            const nnn = (b << 8) + (c << 4) + d;
                                                                                            if (logger) logger.log(`2nnn - CALL addr: nnn=${nnn.toString(16)}`);
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 2 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 300..307
                                                                                    src/chip8.js on lines 414..421

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

                                                                                    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

                                                                                        case 0x1:
                                                                                          {
                                                                                            // 1nnn - JP addr
                                                                                            const nnn = (b << 8) + (c << 4) + d;
                                                                                            if (logger) logger.log(`1nnn - JP addr: nnn=${nnn.toString(16)}`);
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 2 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 309..316
                                                                                    src/chip8.js on lines 414..421

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

                                                                                    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 6 locations. Consider refactoring.
                                                                                    Open

                                                                                          if (c === 0x1 && d === 0x5) {
                                                                                            const x = b;
                                                                                            if (logger) logger.log(`Fx15 - LD DT, Vx, Vx=${x.toString(16)}`);
                                                                                            return module.exports.ldDTVx(chip, x);
                                                                                          }
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 5 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 461..465
                                                                                    src/chip8.js on lines 474..478
                                                                                    src/chip8.js on lines 480..484
                                                                                    src/chip8.js on lines 486..490
                                                                                    src/chip8.js on lines 492..496

                                                                                    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 6 locations. Consider refactoring.
                                                                                    Open

                                                                                          if (c === 0x2 && d === 0x9) {
                                                                                            const x = b;
                                                                                            if (logger) logger.log(`Fx29, Vx=${x.toString(16)}`);
                                                                                            return module.exports.ldFVx(chip, x);
                                                                                          }
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 5 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 461..465
                                                                                    src/chip8.js on lines 468..472
                                                                                    src/chip8.js on lines 474..478
                                                                                    src/chip8.js on lines 486..490
                                                                                    src/chip8.js on lines 492..496

                                                                                    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 6 locations. Consider refactoring.
                                                                                    Open

                                                                                          if (c === 0x5 && d === 0x5) {
                                                                                            const x = b;
                                                                                            if (logger) logger.log(`Fx55, Vx=${x.toString(16)}`);
                                                                                            return module.exports.ldIndirectIVx(chip, x);
                                                                                          }
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 5 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 461..465
                                                                                    src/chip8.js on lines 468..472
                                                                                    src/chip8.js on lines 474..478
                                                                                    src/chip8.js on lines 480..484
                                                                                    src/chip8.js on lines 486..490

                                                                                    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 6 locations. Consider refactoring.
                                                                                    Open

                                                                                          if (c === 0x1 && d === 0xe) {
                                                                                            const x = b;
                                                                                            if (logger) logger.log(`Fx1E - ADD I, Vx=${x.toString(16)}`);
                                                                                            return module.exports.addIVx(chip, x);
                                                                                          }
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 5 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 461..465
                                                                                    src/chip8.js on lines 468..472
                                                                                    src/chip8.js on lines 480..484
                                                                                    src/chip8.js on lines 486..490
                                                                                    src/chip8.js on lines 492..496

                                                                                    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 6 locations. Consider refactoring.
                                                                                    Open

                                                                                          if (c === 0x0 && d === 0x7) {
                                                                                            const x = b;
                                                                                            if (logger) logger.log(`Fx07 - LD Vx, DT, Vx=${x.toString(16)}`);
                                                                                            return module.exports.ldVxDT(chip, x);
                                                                                          }
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 5 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 468..472
                                                                                    src/chip8.js on lines 474..478
                                                                                    src/chip8.js on lines 480..484
                                                                                    src/chip8.js on lines 486..490
                                                                                    src/chip8.js on lines 492..496

                                                                                    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 6 locations. Consider refactoring.
                                                                                    Open

                                                                                          if (c === 0x3 && d === 0x3) {
                                                                                            const x = b;
                                                                                            if (logger) logger.log(`Fx33, Vx=${x.toString(16)}`);
                                                                                            return module.exports.ldB(chip, x);
                                                                                          }
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 5 other locations - About 2 hrs to fix
                                                                                    src/chip8.js on lines 461..465
                                                                                    src/chip8.js on lines 468..472
                                                                                    src/chip8.js on lines 474..478
                                                                                    src/chip8.js on lines 480..484
                                                                                    src/chip8.js on lines 492..496

                                                                                    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

                                                                                          if (c === 0xa && d === 0x1) {
                                                                                            const x = b;
                                                                                            if (logger) logger.log(`ExA1 - SKNP Vx, Vx=${x.toString(16)}`);
                                                                                            return module.exports.sknp(chip, x, keyboard.getKeys());
                                                                                          }
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 1 other location - About 1 hr to fix
                                                                                    src/chip8.js on lines 447..451

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

                                                                                    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

                                                                                          if (c === 0x9 && d === 0xe) {
                                                                                            const x = b;
                                                                                            if (logger) logger.log(`Ex9E - SKP Vx, Vx=${x.toString(16)}`);
                                                                                            return module.exports.skp(chip, x, keyboard.getKeys());
                                                                                          }
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 1 other location - About 1 hr to fix
                                                                                    src/chip8.js on lines 453..457

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

                                                                                    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

                                                                                    function shrX(chip8, x) {
                                                                                      const vx = chip8.v[x];
                                                                                      chip8.v[0xf] = vx & 0b00000001;
                                                                                      chip8.v[x] = vx >> 1;
                                                                                      return chip8;
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 1 other location - About 1 hr to fix
                                                                                    src/chip8.js on lines 175..180

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

                                                                                    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

                                                                                    function shlX(chip8, x) {
                                                                                      const vx = chip8.v[x];
                                                                                      chip8.v[0xf] = vx >> 7;
                                                                                      chip8.v[x] = vx << 1;
                                                                                      return chip8;
                                                                                    Severity: Major
                                                                                    Found in src/chip8.js and 1 other location - About 1 hr to fix
                                                                                    src/chip8.js on lines 161..166

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

                                                                                    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

                                                                                    function skp(chip8, x, keys) {
                                                                                      if (keys[chip8.v[x]] === true) chip8.pc += 2;
                                                                                      return chip8;
                                                                                    }
                                                                                    Severity: Minor
                                                                                    Found in src/chip8.js and 1 other location - About 30 mins to fix
                                                                                    src/chip8.js on lines 232..235

                                                                                    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

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

                                                                                    function sknp(chip8, x, keys) {
                                                                                      if (keys[chip8.v[x]] === false) chip8.pc += 2;
                                                                                      return chip8;
                                                                                    }
                                                                                    Severity: Minor
                                                                                    Found in src/chip8.js and 1 other location - About 30 mins to fix
                                                                                    src/chip8.js on lines 227..230

                                                                                    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