neyric/wireit

View on GitHub
sandbox/grouping/js/GroupUtils.js

Summary

Maintainability
F
1 wk
Test Coverage

File GroupUtils.js has 933 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function() {

    /**
    * Contains utility functions to do with groups (also one or two more general ones)
    * @class GroupUtils
Severity: Major
Found in sandbox/grouping/js/GroupUtils.js - About 2 days to fix

    Function generateTerminalMap has 117 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        generateTerminalMap: function(group, usedNames, containerMap, groupMap)
        {
            var self = this;
            
            var mergeTerminalOverrides = function(terminalConfigs, overrides, usedNames, forceVisible, terminalMap)
    Severity: Major
    Found in sandbox/grouping/js/GroupUtils.js - About 4 hrs to fix

      Function generateFieldMap has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          generateFieldMap: function(group, usedNames, containerMap, groupMap)
          {
              var self = this;
              
              var allContainers = [];
      Severity: Major
      Found in sandbox/grouping/js/GroupUtils.js - About 3 hrs to fix

        Function addWireConfig has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            addWireConfig: function(group, getInternalContainerId, getExternalTerminalName, externalWires, internalWires, groupIndex)
            {
                var pushUniqueWireConfig = function(wires, newWire) {
                  var foundWire= false;
                  var wire;
        Severity: Major
        Found in sandbox/grouping/js/GroupUtils.js - About 2 hrs to fix

          Function getOverridesFromUI has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getOverridesFromUI: function(containerUIMap, groupUIMap)
              {
                  containerOverrides = [];
                  groupOverrides = [];
                  
          Severity: Major
          Found in sandbox/grouping/js/GroupUtils.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 getCollapsedConfig has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  getCollapsedConfig: function(group, map)
                  {
                      if (!Y.Lang.isObject(map))
                      map = Y.GroupUtils.getMap(group);
                      
              Severity: Minor
              Found in sandbox/grouping/js/GroupUtils.js - About 1 hr to fix

                Function getMap has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    getMap: function(group)
                    {
                        
                        //assume no group container case
                        if (Y.Lang.isValue(group.groupContainer))
                Severity: Minor
                Found in sandbox/grouping/js/GroupUtils.js - About 1 hr to fix

                  Function generateTerminals has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      generateTerminals: function(terminalConfigs, overrides, external, usedNames)
                      {
                          var terminals = [];
                          var visibleTerminals = [];
                          for (var mI in terminalConfigs)
                  Severity: Minor
                  Found in sandbox/grouping/js/GroupUtils.js - About 1 hr to fix

                    Function workOutCenter has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        workOutCenter: function(group)
                        {
                            var bounds = {};
                            
                            var setBound = function(position)
                    Severity: Minor
                    Found in sandbox/grouping/js/GroupUtils.js - About 1 hr to fix

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

                          getExternalToInternalMap: function(map)
                          {
                              var containerMap = {"fields" : {}, "terminals" : {}};
                              var groupMap = {"fields" : {}, "terminals" : {}};
                                      
                      Severity: Minor
                      Found in sandbox/grouping/js/GroupUtils.js - About 1 hr to fix

                        Function addWiresForContainer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                var addWiresForContainer = function(c, getExternalName)
                                    {
                                    for (var wI in c.wires)
                                    {
                                        var w = c.wires[wI];
                        Severity: Minor
                        Found in sandbox/grouping/js/GroupUtils.js - About 1 hr to fix

                          Function generateExternal has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  var generateExternal = function(ftMap)
                                  {
                                      for (var cI in ftMap)
                                      {
                                      var c = ftMap[cI];
                          Severity: Minor
                          Found in sandbox/grouping/js/GroupUtils.js - About 1 hr to fix

                            Function mergeFieldOverrides has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                mergeFieldOverrides : function(fieldConfigs, overrides, usedNames, forceVisible, fieldMap)
                                {
                                    for (var fI in fieldConfigs)
                                    {
                                    var f = fieldConfigs[fI];
                            Severity: Minor
                            Found in sandbox/grouping/js/GroupUtils.js - About 1 hr to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if (t.options.name == name)
                                                  {
                                                  terminal = t;
                                                  break;
                                                  }
                              Severity: Major
                              Found in sandbox/grouping/js/GroupUtils.js - About 45 mins to fix

                                Function addWireConfig has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    addWireConfig: function(group, getInternalContainerId, getExternalTerminalName, externalWires, internalWires, groupIndex)
                                Severity: Minor
                                Found in sandbox/grouping/js/GroupUtils.js - About 45 mins to fix

                                  Function mergeTerminalOverrides has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          var mergeTerminalOverrides = function(terminalConfigs, overrides, usedNames, forceVisible, terminalMap)
                                  Severity: Minor
                                  Found in sandbox/grouping/js/GroupUtils.js - About 35 mins to fix

                                    Function mergeFieldOverrides has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        mergeFieldOverrides : function(fieldConfigs, overrides, usedNames, forceVisible, fieldMap)
                                    Severity: Minor
                                    Found in sandbox/grouping/js/GroupUtils.js - About 35 mins to fix

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

                                          fieldConfigsFromModules: function(modules, getBaseConfig)
                                          {
                                              var config = {};
                                              
                                              for (var mI in modules)
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 7 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 1087..1114

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

                                      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

                                          terminalConfigsFromModules: function(modules, getBaseConfig)
                                          {
                                              var config = {};
                                              
                                              for (var mI in modules)
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 7 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 1032..1059

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

                                      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

                                              for (var cI in map.containerMap)
                                              {
                                              var c = map.containerMap[cI];
                                              
                                              for (var fName in c.fields)
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 6 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 295..314

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

                                      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

                                              for (var cI in map.groupMap)
                                              {
                                              var c = map.groupMap[cI];
                                              
                                              for (var fName in c.fields)
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 6 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 274..293

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

                                      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

                                              for (var tName in g.terminals)
                                              {
                                                  var t = g.terminals[tName];
                                                  var o = {}
                                                  o.visible = t.visible.checked;
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 4 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 349..362

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

                                      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

                                              for (var tName in c.terminals)
                                              {
                                                  var t = c.terminals[tName];
                                                  var o = {}
                                                  o.visible = t.visible.checked;
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 4 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 386..399

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

                                      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

                                          generateFreshName : function(name, usedNames)
                                          {
                                              var used = function(name)
                                                  {
                                                      return Y.Lang.isValue(usedNames[name]);
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 4 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 991..1016

                                      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

                                          generateNextName: function(name, usedNames)
                                          {
                                              var used = function(name)
                                                  {
                                                      return Y.Lang.isValue(usedNames[name]);
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 4 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 809..834

                                      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

                                              for (var fName in g.fields)
                                              {
                                                  var f = g.fields[fName];
                                                  var o = {}
                                                  o.visible = f.visible.checked;
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 3 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 335..346

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

                                      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

                                              for (var fName in c.fields)
                                              {
                                                  var f = c.fields[fName];
                                                  var o = {}
                                                  o.visible = f.visible.checked;
                                      Severity: Major
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 3 hrs to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 372..383

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

                                      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 (Y.Lang.isValue(usedNames.fields[o.rename]))
                                                      throw {"type" : "MappingError", "message" : "Two identical field names specified (" + o.rename + ")"}
                                      Severity: Minor
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 55 mins to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 544..545

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

                                      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 (Y.Lang.isValue(usedNames.terminals[o.rename]))
                                                          throw {"type" : "MappingError", "message" : "Two identical terminal names specified (" + o.rename + ")"}
                                      Severity: Minor
                                      Found in sandbox/grouping/js/GroupUtils.js and 1 other location - About 55 mins to fix
                                      sandbox/grouping/js/GroupUtils.js on lines 852..853

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

                                      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