neyric/wireit

View on GitHub
sandbox/grouping/examples/sawire/ExecutionFrame.js

Summary

Maintainability
F
2 wks
Test Coverage

Function execute has a Cognitive Complexity of 151 (exceeds 5 allowed). Consider refactoring.
Open

   execute: function(moduleId,params) {

      var moduleBodyEl;
      try {
         
Severity: Minor
Found in sandbox/grouping/examples/sawire/ExecutionFrame.js - About 3 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 execute has 307 lines of code (exceeds 25 allowed). Consider refactoring.
Open

   execute: function(moduleId,params) {

      var moduleBodyEl;
      try {
         
Severity: Major
Found in sandbox/grouping/examples/sawire/ExecutionFrame.js - About 1 day to fix

    File ExecutionFrame.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * An "ExecutionFrame" is the equivalent to the jsBox layer.
     * It contains a set module instances and a set of wires linking them.
     * @class ExecutionFrame
     * @constructor
    Severity: Minor
    Found in sandbox/grouping/examples/sawire/ExecutionFrame.js - About 5 hrs to fix

      Function mayEval has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

         mayEval: function(moduleId) {
            var t = this.wiringConfig.working.modules[moduleId].name;
      
            //console.log("mayEval", this.wiringConfig.working.modules[moduleId]);
      
      
      Severity: Minor
      Found in sandbox/grouping/examples/sawire/ExecutionFrame.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 value has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

               var value = function(a,b,c,d,e,f,g,h) {
      Severity: Major
      Found in sandbox/grouping/examples/sawire/ExecutionFrame.js - About 1 hr to fix

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

        ExecutionFrame.setExecutionStateForContainer =  function(container, state){
            var bodyEl= container.bodyEl;
              if( bodyEl ) {
                 if( state != "js-execution-starting") Y.one(bodyEl).removeClass("js-execution-starting");
                 if( state != "js-execution-ok") Y.one(bodyEl).removeClass("js-execution-ok");
        Severity: Minor
        Found in sandbox/grouping/examples/sawire/ExecutionFrame.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

        Avoid deeply nested control flow statements.
        Open

              else if( t == "ApplyXSLToWorkItem") {
                  var workItemXml= module.value.workitemXML;
                  if( workItemXml == "[wired]") {
                      var wires = this.wiringConfig.working.wires;
                      var paramValue;
        Severity: Major
        Found in sandbox/grouping/examples/sawire/ExecutionFrame.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                            if(wire.tgt.moduleId == moduleId) {
                               id = this.execValues[wire.src.moduleId][wire.src.terminal];
                               break;
                            }
          Severity: Major
          Found in sandbox/grouping/examples/sawire/ExecutionFrame.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if( xml == "[wired]") {
                          var wires = this.wiringConfig.working.wires;
                          var paramValue;
                          for(var i = 0 ; i < wires.length ; i++) {
                             var wire = wires[i];
            Severity: Major
            Found in sandbox/grouping/examples/sawire/ExecutionFrame.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                             for(var i = 0 ; i < wires.length ; i++) {
                                var wire = wires[i];
                                if(wire.tgt.moduleId == moduleId) {
                                   id = this.execValues[wire.src.moduleId][wire.src.terminal];
                                   break;
              Severity: Major
              Found in sandbox/grouping/examples/sawire/ExecutionFrame.js - About 45 mins to fix

                Function executeModules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                   executeModules: function(moduleId, srcTerminal) {
                      
                         //console.log("executeModules", moduleId, srcTerminal);
                         var params = this.execValues[moduleId][srcTerminal];
                      
                Severity: Minor
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.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

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

                      else if(t == "Script") {
                         
                         //console.log("execute jsbox ", module.config.codeText);
                         
                         // build the params list
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 1 other location - About 1 day to fix
                sandbox/jsBox/ExecutionFrame.js on lines 162..238

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

                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( t == "GetWorkItemById" ) {
                          var id= module.value.input;
                          if( id == "[wired]" ) {
                               var wires = this.wiringConfig.working.wires;
                               var paramValue;
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 1 other location - About 1 day to fix
                sandbox/grouping/examples/sawire/ExecutionFrame.js on lines 165..514

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

                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

                      else if( t == "GetCaseById" ) {
                          var id= module.value.input;
                          if( id == "[wired]" ) {
                               var wires = this.wiringConfig.working.wires;
                               var paramValue;
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 1 other location - About 1 day to fix
                sandbox/grouping/examples/sawire/ExecutionFrame.js on lines 144..514

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

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

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

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

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

                Refactorings

                Further Reading

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

                      else if(t == "output") {
                         if(!this.parentFrame) return;
                         
                         var outputName = module.value.name;
                         
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 1 other location - About 7 hrs to fix
                sandbox/jsBox/ExecutionFrame.js on lines 192..238

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

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

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

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

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

                Refactorings

                Further Reading

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

                   executeModules: function(moduleId, srcTerminal) {
                      
                         //console.log("executeModules", moduleId, srcTerminal);
                         var params = this.execValues[moduleId][srcTerminal];
                      
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 1 other location - About 6 hrs to fix
                sandbox/jsBox/ExecutionFrame.js on lines 94..111

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

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

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

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

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

                Refactorings

                Further Reading

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

                      if( t == "callback") {
                         return true;
                      }
                      else if(t == "comment") {
                         return false;
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 1 other location - About 6 hrs to fix
                sandbox/jsBox/ExecutionFrame.js on lines 67..89

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

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

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

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

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

                Refactorings

                Further Reading

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

                   run: function(params) {
                      
                      //console.log("running frame "+this.wiringConfig.name, " with params ", params);
                      
                      var modules = this.wiringConfig.working.modules,
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 1 other location - About 6 hrs to fix
                sandbox/jsBox/ExecutionFrame.js on lines 29..59

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

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

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

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

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

                Refactorings

                Further Reading

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

                          for(var i = 0 ; i < wires.length ; i++) {
                             var wire = wires[i];
                             if(wire.tgt.moduleId == moduleId) {
                                var paramName = wire.tgt.terminal;
                                var paramValue = this.execValues[wire.src.moduleId][wire.src.terminal];
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 2 other locations - About 4 hrs to fix
                sandbox/grouping/examples/sawire/ExecutionFrame.js on lines 505..512
                sandbox/jsBox/ExecutionFrame.js on lines 229..236

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

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

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

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

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

                Refactorings

                Further Reading

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

                         for(var i = 0 ; i < wires.length ; i++) {
                            var wire = wires[i];
                            if(wire.tgt.moduleId == moduleId) {
                               var paramName = wire.tgt.terminal;
                               var paramValue = this.execValues[wire.src.moduleId][wire.src.terminal];
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 2 other locations - About 4 hrs to fix
                sandbox/grouping/examples/sawire/ExecutionFrame.js on lines 455..462
                sandbox/jsBox/ExecutionFrame.js on lines 229..236

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

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

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

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

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

                Refactorings

                Further Reading

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

                var ExecutionFrame = function(wiringConfig, frameLevel, parentFrame, parentIndex) {
                   
                   // save the initial config
                   this.wiringConfig = wiringConfig;
                   
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 1 other location - About 2 hrs to fix
                sandbox/jsBox/ExecutionFrame.js on lines 8..21

                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

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

                         for(var key in module.value) {
                            if(module.value.hasOwnProperty(key)) {
                               params[key] = module.value[key];
                            }
                         }
                Severity: Major
                Found in sandbox/grouping/examples/sawire/ExecutionFrame.js and 1 other location - About 1 hr to fix
                sandbox/jsBox/ExecutionFrame.js on lines 222..226

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

                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