Shoobx/OrgChart.js

View on GitHub

Showing 37 of 67 total issues

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

  _onPanning(event) {
    let chart = event.currentTarget;

    if (chart.dataset.panning === 'false') {
      return;
Severity: Minor
Found in src/orgchart.js - About 1 hr to fix

    Function _clickTopEdge has a Cognitive Complexity of 12 (exceeds 5 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

    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 _onPanning has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      _onPanning(event) {
        let chart = event.currentTarget;
    
        if (chart.dataset.panning === 'false') {
          return;
    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 _clickBottomEdge has a Cognitive Complexity of 12 (exceeds 5 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

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

      _clickExportButton() {
        let opts = this.options,
          chartContainer = this.chartContainer,
          mask = chartContainer.querySelector(':scope > .mask'),
          sourceChart = chartContainer.querySelector('.orgchart:not(.hidden)'),
    Severity: Minor
    Found in src/orgchart.js - About 1 hr to fix

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

        _onPanStart(event) {
          let chart = event.currentTarget;
      
          if (this._closest(event.target, (el) => el.classList && el.classList.contains('node')) ||
            (event.touches && event.touches.length > 1)) {
      Severity: Minor
      Found in src/orgchart.js - About 1 hr to fix

        Function _switchHorizontalArrow has 34 lines of code (exceeds 25 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 1 hr to fix

          Function _clickToggleButton has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _clickToggleButton(event) {
              let that = this,
                toggleBtn = event.target,
                descWrapper = toggleBtn.parentNode.nextElementSibling,
                descendants = Array.from(descWrapper.querySelectorAll('.node')),
          Severity: Minor
          Found in src/orgchart.js - About 1 hr to fix

            Function _buildParentNode has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _buildParentNode(currentRoot, nodeData, callback) {
                let that = this,
                  table = document.createElement('table');
            
                nodeData.relationship = nodeData.relationship || '001';
            Severity: Minor
            Found in src/orgchart.js - About 1 hr to fix

              Function _getNodeState has 28 lines of code (exceeds 25 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

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

                  _onDrop(event) {
                    let dropZone = event.currentTarget,
                      chart = this.chart,
                      dragged = this.dragged,
                      dragZone = this._closest(dragged, function (el) {
                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 showChildren has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

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

                    _onPanStart(event) {
                      let chart = event.currentTarget;
                  
                      if (this._closest(event.target, (el) => el.classList && el.classList.contains('node')) ||
                        (event.touches && event.touches.length > 1)) {
                  Severity: Minor
                  Found in src/orgchart.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

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

                    _attachRel(data, flags) {
                      data.relationship = flags + (data.children && data.children.length > 0 ? 1 : 0);
                      if (data.children) {
                        for (let item of data.children) {
                          this._attachRel(item, '1' + (data.children.length > 1 ? 1 : 0));
                  Severity: Minor
                  Found in src/orgchart.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

                  Function showSiblings has a Cognitive Complexity of 7 (exceeds 5 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 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

                  Function _setChartScale has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _setChartScale(chart, zoomIn) {
                      const scales = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3];
                      let scale = scales[7];
                  
                      if (chart.style.transform.length === 0) {
                  Severity: Minor
                  Found in src/orgchart.js - About 25 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

                  Function hideSiblings has a Cognitive Complexity of 6 (exceeds 5 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: Minor
                  Found in src/orgchart.js - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language