neyric/wireit

View on GitHub

Showing 497 of 497 total issues

Function removeChild has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

XNode.prototype.removeChild = function(node) {
  var newChildren = [];
  for (var i = 0; i < this.childNodes.length; ++i) {
    var c = this.childNodes[i];
    if (c != node) {
Severity: Minor
Found in sandbox/grouping/examples/sawire/xml/dom.js - About 2 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 replaceChild has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

XNode.prototype.replaceChild = function(newNode, oldNode) {
  if (oldNode == newNode) {
    return;
  }

Severity: Minor
Found in sandbox/grouping/examples/sawire/xml/dom.js - About 2 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 evaluate has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

BinaryExpr.prototype.evaluate = function(ctx) {
  var ret;
  switch (this.op.value) {
    case 'or':
      ret = new BooleanValue(this.expr1.evaluate(ctx).booleanValue() ||
Severity: Major
Found in sandbox/grouping/examples/sawire/xml/xpath.js - About 2 hrs to fix

    Function generateFields has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        generateFields: function(fieldConfigs, overrides, external)
        {
            var fields = [];
            var neededFields = [];
            var terminalNamesUsed  = [];
    Severity: Major
    Found in sandbox/grouping/js/GroupUtils.js - About 2 hrs to fix

      Function CSS has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      SyntaxHighlighter.brushes.CSS = function()
      {
          function getKeywordsCSS(str)
          {
              return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
      Severity: Major
      Found in sandbox/res/SyntaxHighlighter/shBrushCss.js - About 2 hrs to fix

        Function Php has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        SyntaxHighlighter.brushes.Php = function()
        {
            var funcs    =    'abs acos acosh addcslashes addslashes ' +
                            'array_change_key_case array_chunk array_combine array_count_values array_diff '+
                            'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
        Severity: Major
        Found in sandbox/res/SyntaxHighlighter/shBrushPhp.js - About 2 hrs to fix

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

                  while (s - ds >= 0 && stack[s - ds].tag == pattern[p]) {
                    qmatch.push(stack[s - ds]);
                    ds += 1;
                    match.matchlength += 1;
                  }
          Severity: Major
          Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 2 hrs to fix
          sandbox/grouping/examples/sawire/xml/xpath.js on lines 276..280

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

          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

                while (s - ds >= 0 && stack[s - ds].tag == pattern[p]) {
                  qmatch.push(stack[s - ds]);
                  ds += 1;
                  match.matchlength += 1;
                }
          Severity: Major
          Found in sandbox/grouping/examples/sawire/xml/xpath.js and 1 other location - About 2 hrs to fix
          sandbox/grouping/examples/sawire/xml/xpath.js on lines 295..299

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

          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 addRemapInput has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  var addRemapInput = function(name, moduleId, showOn, showCancel, defaultVisible, defaultName, visibleReadOnly, showSide, defaultSide)
                  {
                      var addTds = function(row) {
                          tds = [];
                          
          Severity: Major
          Found in sandbox/grouping/js/Group.js - About 2 hrs to fix

            Function _drawArrow has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

               _drawArrow: function(src, tgt) {
            
            
                  var d = 7, // arrow width/2
                      distance = Math.sqrt(Math.pow(src[0]-tgt[0],2) + Math.pow(src[1]-tgt[1],2)),
            Severity: Minor
            Found in src/arrow-wire/js/arrow-wire.js - About 2 hrs to fix

              Function _drawArrow has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                 _drawArrow: function(src, tgt) {
              
              
                    var d = 7, // arrow width/2
                        distance = Math.sqrt(Math.pow(src[0]-tgt[0],2) + Math.pow(src[1]-tgt[1],2)),
              Severity: Minor
              Found in build/wireit-all/wireit-all.js - About 2 hrs to fix

                Function _drawArrow has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                   _drawArrow: function(src, tgt) {
                
                
                      var d = 7, // arrow width/2
                          distance = Math.sqrt(Math.pow(src[0]-tgt[0],2) + Math.pow(src[1]-tgt[1],2)),
                Severity: Minor
                Found in build/wireit-all/wireit-all-debug.js - About 2 hrs to fix

                  Function _drawArrow has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                     _drawArrow: function(src, tgt) {
                  
                  
                        var d = 7, // arrow width/2
                            distance = Math.sqrt(Math.pow(src[0]-tgt[0],2) + Math.pow(src[1]-tgt[1],2)),
                  Severity: Minor
                  Found in build/arrow-wire/arrow-wire.js - About 2 hrs to fix

                    Function _drawArrow has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                       _drawArrow: function(src, tgt) {
                    
                    
                          var d = 7, // arrow width/2
                              distance = Math.sqrt(Math.pow(src[0]-tgt[0],2) + Math.pow(src[1]-tgt[1],2)),
                    Severity: Minor
                    Found in build/arrow-wire/arrow-wire-debug.js - About 2 hrs to fix

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

                          Y.AndGate = Y.Base.create("andgate-container", Y.LogicContainer, [], {
                              afterLogicInputsChange: function(e) {
                                  this.set('logicOutput', e.newVal._INPUT1 && e.newVal._INPUT2 );
                              }
                          });
                      Severity: Major
                      Found in app-examples/logic-gates/logic-gates.js and 1 other location - About 2 hrs to fix
                      app-examples/logic-gates/logic-gates.js on lines 204..208

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

                      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

                        'floor': function(ctx) {
                          assert(this.args.length == 1);
                          var num = this.args[0].evaluate(ctx).numberValue();
                          return new NumberValue(Math.floor(num));
                        },
                      Severity: Major
                      Found in sandbox/grouping/examples/sawire/xml/xpath.js and 2 other locations - About 2 hrs to fix
                      sandbox/grouping/examples/sawire/xml/xpath.js on lines 1192..1196
                      sandbox/grouping/examples/sawire/xml/xpath.js on lines 1198..1202

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

                      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

                        'round': function(ctx) {
                          assert(this.args.length == 1);
                          var num = this.args[0].evaluate(ctx).numberValue();
                          return new NumberValue(Math.round(num));
                        },
                      Severity: Major
                      Found in sandbox/grouping/examples/sawire/xml/xpath.js and 2 other locations - About 2 hrs to fix
                      sandbox/grouping/examples/sawire/xml/xpath.js on lines 1186..1190
                      sandbox/grouping/examples/sawire/xml/xpath.js on lines 1192..1196

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

                      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

                        'ceiling': function(ctx) {
                          assert(this.args.length == 1);
                          var num = this.args[0].evaluate(ctx).numberValue();
                          return new NumberValue(Math.ceil(num));
                        },
                      Severity: Major
                      Found in sandbox/grouping/examples/sawire/xml/xpath.js and 2 other locations - About 2 hrs to fix
                      sandbox/grouping/examples/sawire/xml/xpath.js on lines 1186..1190
                      sandbox/grouping/examples/sawire/xml/xpath.js on lines 1198..1202

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

                      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

                          Y.OrGate = Y.Base.create("orgate-container", Y.LogicContainer, [], {
                              afterLogicInputsChange: function(e) {
                                  this.set('logicOutput', e.newVal._INPUT1 || e.newVal._INPUT2 );
                              }
                          });
                      Severity: Major
                      Found in app-examples/logic-gates/logic-gates.js and 1 other location - About 2 hrs to fix
                      app-examples/logic-gates/logic-gates.js on lines 198..202

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

                      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(d2 < 0.01) {
                                                  dx = 0.1 * Math.random() + 0.1;
                                                  dy = 0.1 * Math.random() + 0.1;
                                                  d2 = dx * dx + dy * dy;
                                              }
                      Severity: Major
                      Found in sandbox/wireit-layout/wireit-layout.js and 1 other location - About 1 hr to fix
                      sandbox/wireit-layout/wireit-layout.js on lines 192..196

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

                      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