Shoobx/OrgChart.js

View on GitHub

Showing 37 of 67 total issues

File orgchart.js has 1620 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export default class OrgChart {
  constructor(options) {
    this._name = 'OrgChart';
    Promise.prototype.finally = function (callback) {
      let P = this.constructor;
Severity: Major
Found in src/orgchart.js - About 4 days to fix

    OrgChart has 66 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class OrgChart {
      constructor(options) {
        this._name = 'OrgChart';
        Promise.prototype.finally = function (callback) {
          let P = this.constructor;
    Severity: Major
    Found in src/orgchart.js - About 1 day to fix

      Function _clickHorizontalEdge has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

        _clickHorizontalEdge(event) {
          event.stopPropagation();
          let that = this,
            opts = this.options,
            hEdge = event.target,
      Severity: Minor
      Found in src/orgchart.js - About 5 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _createNode has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _createNode(nodeData, level) {
          let that = this,
            opts = this.options;
      
          return new Promise(function (resolve, reject) {
      Severity: Major
      Found in src/orgchart.js - About 4 hrs to fix

        Function buildHierarchy has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

          buildHierarchy(appendTo, nodeData, level, callback) {
            // Construct the node
            let that = this,
              opts = this.options,
              nodeWrapper,
        Severity: Minor
        Found in src/orgchart.js - About 4 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 buildHierarchy has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          buildHierarchy(appendTo, nodeData, level, callback) {
            // Construct the node
            let that = this,
              opts = this.options,
              nodeWrapper,
        Severity: Major
        Found in src/orgchart.js - About 3 hrs to fix

          Function constructor has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(options) {
              this._name = 'OrgChart';
              Promise.prototype.finally = function (callback) {
                let P = this.constructor;
          
          
          Severity: Major
          Found in src/orgchart.js - About 3 hrs to fix

            Function _onDrop has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _onDrop(event) {
                let dropZone = event.currentTarget,
                  chart = this.chart,
                  dragged = this.dragged,
                  dragZone = this._closest(dragged, function (el) {
            Severity: Major
            Found in src/orgchart.js - About 3 hrs to fix

              Function hideSiblings has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                hideSiblings(node, direction) {
                  let nodeContainer = this._closest(node, (el) => el.nodeName === 'TABLE').parentNode,
                    siblings = this._siblings(nodeContainer);
              
                  siblings.forEach((sib) => {
              Severity: Major
              Found in src/orgchart.js - About 3 hrs to fix

                Function _onDragStart has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _onDragStart(event) {
                    let nodeDiv = event.target,
                      opts = this.options,
                      isFirefox = /firefox/.test(window.navigator.userAgent.toLowerCase());
                
                
                Severity: Major
                Found in src/orgchart.js - About 2 hrs to fix

                  Function _buildSiblingNode has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _buildSiblingNode(nodeChart, nodeData, callback) {
                      let that = this,
                        newSiblingCount = nodeData.siblings ? nodeData.siblings.length : nodeData.children.length,
                        existingSibligCount = nodeChart.parentNode.nodeName === 'TD' ? this._closest(nodeChart, (el) => {
                          return el.nodeName === 'TR';
                  Severity: Major
                  Found in src/orgchart.js - About 2 hrs to fix

                    Function _clickHorizontalEdge has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _clickHorizontalEdge(event) {
                        event.stopPropagation();
                        let that = this,
                          opts = this.options,
                          hEdge = event.target,
                    Severity: Major
                    Found in src/orgchart.js - About 2 hrs to fix

                      Function _switchHorizontalArrow has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                        _switchHorizontalArrow(node) {
                          let opts = this.options,
                            leftEdge = node.querySelector('.leftEdge'),
                            rightEdge = node.querySelector('.rightEdge'),
                            temp = this._closest(node, (el) => el.nodeName === 'TABLE').parentNode;
                      Severity: Minor
                      Found in src/orgchart.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 constructor has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                        constructor(options) {
                          this._name = 'OrgChart';
                          Promise.prototype.finally = function (callback) {
                            let P = this.constructor;
                      
                      
                      Severity: Minor
                      Found in src/orgchart.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 _getNodeState has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                        _getNodeState(node, relation) {
                          let criteria,
                            state = { 'exist': false, 'visible': false };
                      
                          if (relation === 'parent') {
                      Severity: Minor
                      Found in src/orgchart.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 _onDragStart has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                        _onDragStart(event) {
                          let nodeDiv = event.target,
                            opts = this.options,
                            isFirefox = /firefox/.test(window.navigator.userAgent.toLowerCase());
                      
                      
                      Severity: Minor
                      Found in src/orgchart.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 showSiblings has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        showSiblings(node, direction) {
                          // firstly, show the sibling td tags
                          let siblings = [],
                            temp = this._closest(node, (el) => el.nodeName === 'TABLE').parentNode;
                      
                      
                      Severity: Minor
                      Found in src/orgchart.js - About 1 hr to fix

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

                          _clickTopEdge(event) {
                            event.stopPropagation();
                            let that = this,
                              topEdge = event.target,
                              node = topEdge.parentNode,
                        Severity: Minor
                        Found in src/orgchart.js - About 1 hr to fix

                          Function hideChildren has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            hideChildren(node) {
                              let that = this,
                                temp = this._nextAll(node.parentNode.parentNode),
                                lastItem = temp[temp.length - 1],
                                lines = [];
                          Severity: Minor
                          Found in src/orgchart.js - About 1 hr to fix

                            Function _clickBottomEdge has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _clickBottomEdge(event) {
                                event.stopPropagation();
                                let that = this,
                                  opts = this.options,
                                  bottomEdge = event.target,
                            Severity: Minor
                            Found in src/orgchart.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language