alessandrocuzzocrea/chip-8-emulator-js

View on GitHub

Showing 50 of 76 total issues

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

                Function render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function render(chip, canvas) {
                  const ctx = canvas.getContext("2d");
                  ctx.fillStyle = "#1abc9c";
                  ctx.fillRect(0, 0, canvas.width, canvas.height);
                
                Severity: Minor
                Found in src/renderer.js - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function init() {
                  canvas = document.querySelector("#emulator");
                  romSelect = document.querySelector("select#rom-select");
                  romSelect.onchange = e => loadRom(event.target.value);
                
                Severity: Minor
                Found in src/emulator.js - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function update(chip) {
                  function formatDebugString(str, digits, val) {
                    return `${str}: ${val
                      .toString(16)
                      .padStart(digits, "0")
                Severity: Minor
                Found in src/ui.js - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Severity
                Category
                Status
                Source
                Language