alexbrjo/MolassOS

View on GitHub

Showing 14 of 185 total issues

Function assemble has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

var assemble = function (src, size) {

    /** The Project Control group */
    var pcGroup = new RegExp("^(JMP|RET|CALL)$|^[JRC]{1}(NZ|NC|PO|P|Z|P|PE|M)$");
    /** The math group, needs immed value */
Severity: Minor
Found in src/asm/Assemble.js - About 5 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 MolassesRegisters has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

function MolassesRegisters () {
    return {
        memory: null,
        /**
         * The 8-bit A (Accumulator) Register
Severity: Minor
Found in src/hardware/Register.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 assemble has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var assemble = function (src, size) {

    /** The Project Control group */
    var pcGroup = new RegExp("^(JMP|RET|CALL)$|^[JRC]{1}(NZ|NC|PO|P|Z|P|PE|M)$");
    /** The math group, needs immed value */
Severity: Major
Found in src/asm/Assemble.js - About 4 hrs to fix

    Function Memory has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    function Memory (s, mem_type) {
        
        // Validate size parameter
        if (s < 1) {
            throw new Error("Memory must have at least 1 byte.");
    Severity: Minor
    Found in src/hardware/Memory.js - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function MolassesRegisters has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function MolassesRegisters () {
        return {
            memory: null,
            /**
             * The 8-bit A (Accumulator) Register
    Severity: Major
    Found in src/hardware/Register.js - About 3 hrs to fix

      `` has 30 functions (exceeds 20 allowed). Consider refactoring.
      Open

          return {
              memory: null,
              /**
               * The 8-bit A (Accumulator) Register
               */
      Severity: Minor
      Found in src/hardware/Register.js - About 3 hrs to fix

        Function exports has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function (grunt) {
            grunt.initConfig({
                pkg: grunt.file.readJSON('package.json'),
                concat: {
                    options: {
        Severity: Major
        Found in Gruntfile.js - About 3 hrs to fix

          Function Memory has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function Memory (s, mem_type) {
              
              // Validate size parameter
              if (s < 1) {
                  throw new Error("Memory must have at least 1 byte.");
          Severity: Major
          Found in src/hardware/Memory.js - About 2 hrs to fix

            Function preprocess has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            var preprocess = function (src) {
            
                /** Preprocessor FSM states */
                var state = new WaitState('');
            
            
            Severity: Minor
            Found in src/asm/Preprocess.js - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

            Function Molasses8080 has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Molasses8080 (memory) {
                /** General, flag, program, stack registers */
                var reg = MolassesRegisters();
                /** The Memory of the cpu: 256 mb */
                var mem = (reg.memory = (memory || new Memory(256)));
            Severity: Minor
            Found in src/hardware/Cpu.js - About 1 hr to fix

              Function preprocess has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var preprocess = function (src) {
              
                  /** Preprocessor FSM states */
                  var state = new WaitState('');
              
              
              Severity: Minor
              Found in src/asm/Preprocess.js - About 1 hr to fix

                Function NumberState has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var NumberState = function (char) {
                    this.name = "NUMBER";
                    var content = char;
                    this.nextNumber = function (char) {
                        // add number to number
                Severity: Minor
                Found in src/asm/PreprocessStates.js - About 1 hr to fix

                  Function NumberState has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var NumberState = function (char) {
                      this.name = "NUMBER";
                      var content = char;
                      this.nextNumber = function (char) {
                          // add number to number
                  Severity: Minor
                  Found in src/asm/PreprocessStates.js - About 55 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 WaitState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var WaitState = function (char) {
                      this.name = "WAIT";
                      var content = char;
                      this.nextNumber = function (char) {
                          return { state: new NumberState(char), bin: content};
                  Severity: Minor
                  Found in src/asm/PreprocessStates.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