lib/DOMutil.js

Summary

Maintainability
C
1 day
Test Coverage

Function drawPoint has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.drawPoint = function(x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) {
  var point;
  if (groupTemplate.style == 'circle') {
    point = exports.getSVGElement('circle', JSONcontainer, svgContainer);
    point.setAttributeNS(null, "cx", x);
Severity: Minor
Found in lib/DOMutil.js - About 1 hr to fix

    Function drawPoint has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.drawPoint = function(x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) {
      var point;
      if (groupTemplate.style == 'circle') {
        point = exports.getSVGElement('circle', JSONcontainer, svgContainer);
        point.setAttributeNS(null, "cx", x);
    Severity: Minor
    Found in lib/DOMutil.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 getDOMElement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer, insertBefore) {
      var element;
      // allocate DOM element, if it doesnt yet exist, create one.
      if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before
        // check if there is an redundant element
    Severity: Minor
    Found in lib/DOMutil.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 getDOMElement has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer, insertBefore) {
      var element;
      // allocate DOM element, if it doesnt yet exist, create one.
      if (JSONcontainer.hasOwnProperty(elementType)) { // this element has been created before
        // check if there is an redundant element
    Severity: Minor
    Found in lib/DOMutil.js - About 1 hr to fix

      Function cleanupElements has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.cleanupElements = function(JSONcontainer) {
        // cleanup the redundant svgElements;
        for (var elementType in JSONcontainer) {
          if (JSONcontainer.hasOwnProperty(elementType)) {
            if (JSONcontainer[elementType].redundant) {
      Severity: Minor
      Found in lib/DOMutil.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 drawBar has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer, style) {
      Severity: Major
      Found in lib/DOMutil.js - About 1 hr to fix

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

        exports.drawPoint = function(x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) {
        Severity: Minor
        Found in lib/DOMutil.js - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status