FelixMcFelix/laughing-ironman

View on GitHub

Showing 59 of 59 total issues

Function VM has a Cognitive Complexity of 257 (exceeds 5 allowed). Consider refactoring.
Open

MVM.VM = function(glctx, manager, codeStore, debugMode) {

    /*
    *    Struct layouts
    *    
Severity: Minor
Found in src/MVM/MVM.js - About 5 days 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 VM has 576 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MVM.VM = function(glctx, manager, codeStore, debugMode) {

    /*
    *    Struct layouts
    *    
Severity: Major
Found in src/MVM/MVM.js - About 2 days to fix

    Function interpret has 524 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.interpret = function() {
            if(this.dead === true){
                return;
            }
    
    
    Severity: Major
    Found in src/MVM/MVM.js - About 2 days to fix

      File MVM.js has 629 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
      * Sketch Virtual Machine
      * Darren Findlay
      *
      * 15th January 2015
      Severity: Major
      Found in src/MVM/MVM.js - About 1 day to fix

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

                        case opCodes.IDIV:
                            //Pop two integers off the stack, divide them and push the new result onto the stack.
                            var i = Math.floor(
                                data.current()
                                    .pop());
        Severity: Major
        Found in src/MVM/MVM.js and 1 other location - About 5 hrs to fix
        src/MVM/MVM.js on lines 223..237

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

        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

                        case opCodes.IMOD:
                            //Pop two integers off the stack, take modulus and push the new result onto the stack.
                            var i = Math.floor(
                                data.current()
                                    .pop());
        Severity: Major
        Found in src/MVM/MVM.js and 1 other location - About 5 hrs to fix
        src/MVM/MVM.js on lines 207..222

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function SketchGen has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

        Sketch.SketchGen = function(){
            var outBuffer = [];
            var programCounter = 0;
            var scopeStack = [];
            var stackPtr = 0;
        Severity: Minor
        Found in src/Code Generator/SketchGen.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

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

                        case opCodes.IMUL:
                            //Pop two integers off the stack, multiply them and push the new result onto the stack.
                            var i = Math.floor(
                                data.current()
                                    .pop());
        Severity: Major
        Found in src/MVM/MVM.js and 2 other locations - About 4 hrs to fix
        src/MVM/MVM.js on lines 162..176
        src/MVM/MVM.js on lines 177..191

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

        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 opCodes.IADD:
                            //Pop two integers off the stack, add them and push the new result onto the stack.
                            var i = Math.floor(
                                data.current()
                                    .pop());
        Severity: Major
        Found in src/MVM/MVM.js and 2 other locations - About 4 hrs to fix
        src/MVM/MVM.js on lines 177..191
        src/MVM/MVM.js on lines 192..206

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

        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 opCodes.ISUB:
                            //Pop two integers off the stack, subbtract them and push the new result onto the stack.
                            var i = Math.floor(
                                data.current()
                                    .pop());
        Severity: Major
        Found in src/MVM/MVM.js and 2 other locations - About 4 hrs to fix
        src/MVM/MVM.js on lines 162..176
        src/MVM/MVM.js on lines 192..206

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function SketchGen has 110 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Sketch.SketchGen = function(){
            var outBuffer = [];
            var programCounter = 0;
            var scopeStack = [];
            var stackPtr = 0;
        Severity: Major
        Found in src/Code Generator/SketchGen.js - About 4 hrs to fix

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

                          case opCodes.FMUL:
                              //Pop two integers off the stack, multiply them and push the new result onto the stack.
                              var i = data.current()
                                      .pop();
                              var j = data.current()
          Severity: Major
          Found in src/MVM/MVM.js and 5 other locations - About 4 hrs to fix
          src/MVM/MVM.js on lines 238..250
          src/MVM/MVM.js on lines 251..263
          src/MVM/MVM.js on lines 277..289
          src/MVM/MVM.js on lines 290..302
          src/MVM/MVM.js on lines 303..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 117.

          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

                          case opCodes.CMPEQ:
                              //Pop two values off the stack, push true if they equate or false if they do not.
                              var i = data.current()
                                      .pop();
                              var j = data.current()
          Severity: Major
          Found in src/MVM/MVM.js and 5 other locations - About 4 hrs to fix
          src/MVM/MVM.js on lines 238..250
          src/MVM/MVM.js on lines 251..263
          src/MVM/MVM.js on lines 264..276
          src/MVM/MVM.js on lines 277..289
          src/MVM/MVM.js on lines 290..302

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

          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

                          case opCodes.FMOD:
                              //Pop two integers off the stack, divide them and push the remainder onto the stack.
                              var i = data.current()
                                      .pop();
                              var j = data.current()
          Severity: Major
          Found in src/MVM/MVM.js and 5 other locations - About 4 hrs to fix
          src/MVM/MVM.js on lines 238..250
          src/MVM/MVM.js on lines 251..263
          src/MVM/MVM.js on lines 264..276
          src/MVM/MVM.js on lines 277..289
          src/MVM/MVM.js on lines 303..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 117.

          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

                          case opCodes.FSUB:
                              //Pop two integers off the stack, subtract them and push the new result onto the stack.
                              var i = data.current()
                                      .pop();
                              var j = data.current()
          Severity: Major
          Found in src/MVM/MVM.js and 5 other locations - About 4 hrs to fix
          src/MVM/MVM.js on lines 238..250
          src/MVM/MVM.js on lines 264..276
          src/MVM/MVM.js on lines 277..289
          src/MVM/MVM.js on lines 290..302
          src/MVM/MVM.js on lines 303..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 117.

          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

                          case opCodes.FDIV:
                              //Pop two integers off the stack, divide them and push the new result onto the stack.
                              var i = data.current()
                                      .pop();
                              var j = data.current()
          Severity: Major
          Found in src/MVM/MVM.js and 5 other locations - About 4 hrs to fix
          src/MVM/MVM.js on lines 238..250
          src/MVM/MVM.js on lines 251..263
          src/MVM/MVM.js on lines 264..276
          src/MVM/MVM.js on lines 290..302
          src/MVM/MVM.js on lines 303..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 117.

          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

                          case opCodes.FADD:
                              //Pop two integers off the stack, add them and push the new result onto the stack.
                              var i = data.current()
                                      .pop();
                              var j = data.current()
          Severity: Major
          Found in src/MVM/MVM.js and 5 other locations - About 4 hrs to fix
          src/MVM/MVM.js on lines 251..263
          src/MVM/MVM.js on lines 264..276
          src/MVM/MVM.js on lines 277..289
          src/MVM/MVM.js on lines 290..302
          src/MVM/MVM.js on lines 303..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 117.

          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

                          case opCodes.CMPGT:
                              var i = data.current()
                                      .pop();
                              var j = data.current()
                                      .pop();
          Severity: Major
          Found in src/MVM/MVM.js and 1 other location - About 4 hrs to fix
          src/MVM/MVM.js on lines 317..328

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

          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

                          case opCodes.CMPLT:
                              var i = data.current()
                                      .pop();
                              var j = data.current()
                                      .pop();
          Severity: Major
          Found in src/MVM/MVM.js and 1 other location - About 4 hrs to fix
          src/MVM/MVM.js on lines 329..340

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

          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

                          case opCodes.BAND:
                              //Pop two values off the stack, push A && B.
                              var i = data.current()
                                      .pop();
                              var j = data.current()
          Severity: Major
          Found in src/MVM/MVM.js and 1 other location - About 3 hrs to fix
          src/MVM/MVM.js on lines 655..668

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

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language