Shoobx/OrgChart.js

View on GitHub
src/orgchart.js

Summary

Maintainability
F
3 wks
Test Coverage

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

                              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

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

                                                  if (!event.targetTouches) { // pan on desktop
                                                    startX = event.pageX - lastX;
                                                    startY = event.pageY - lastY;
                                                  } else if (event.targetTouches.length === 1) { // pan on mobile device
                                                    startX = event.targetTouches[0].pageX - lastX;
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 4 hrs to fix
                                              src/orgchart.js on lines 1780..1788

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

                                              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 (!event.targetTouches) { // pand on desktop
                                                    newX = event.pageX - startX;
                                                    newY = event.pageY - startY;
                                                  } else if (event.targetTouches.length === 1) { // pan on mobile device
                                                    newX = event.targetTouches[0].pageX - startX;
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 4 hrs to fix
                                              src/orgchart.js on lines 1755..1763

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

                                              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 (!direction || (direction && direction !== 'left')) {
                                                    let nextSibs = this._nextAll(nodeContainer);
                                              
                                                    nextSibs.forEach((sib) => {
                                                      Array.from(sib.querySelectorAll('.node')).forEach((node) => {
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 4 hrs to fix
                                              src/orgchart.js on lines 502..512

                                              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

                                                  if (!direction || (direction && direction === 'left')) {
                                                    let preSibs = this._prevAll(nodeContainer);
                                              
                                                    preSibs.forEach((sib) => {
                                                      Array.from(sib.querySelectorAll('.node')).forEach((node) => {
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 4 hrs to fix
                                              src/orgchart.js on lines 513..523

                                              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

                                                _removeClass(elements, classNames) {
                                                  elements.forEach((el) => {
                                                    if (classNames.indexOf(' ') > 0) {
                                                      classNames.split(' ').forEach((className) => el.classList.remove(className));
                                                    } else {
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 3 hrs to fix
                                              src/orgchart.js on lines 179..187

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

                                              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

                                                _addClass(elements, classNames) {
                                                  elements.forEach((el) => {
                                                    if (classNames.indexOf(' ') > 0) {
                                                      classNames.split(' ').forEach((className) => el.classList.add(className));
                                                    } else {
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 3 hrs to fix
                                              src/orgchart.js on lines 188..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 100.

                                              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 (!node.querySelector('.leftEdge')) {
                                                      let rightEdge = document.createElement('i'),
                                                        leftEdge = document.createElement('i');
                                              
                                                      rightEdge.setAttribute('class', 'edge horizontalEdge rightEdge fa');
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 2 hrs to fix
                                              src/orgchart.js on lines 1316..1324

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

                                              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 (!dragged.querySelector('.horizontalEdge')) {
                                                      let rightEdge = document.createElement('i'),
                                                        leftEdge = document.createElement('i');
                                              
                                                      rightEdge.setAttribute('class', 'edge horizontalEdge rightEdge fa');
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 2 hrs to fix
                                              src/orgchart.js on lines 1022..1030

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

                                              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 (prevSib) {
                                                      if (prevSib.classList.contains('hidden')) {
                                                        leftEdge.classList.add('fa-chevron-left');
                                                        leftEdge.classList.remove('fa-chevron-right');
                                                      } else {
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 2 hrs to fix
                                              src/orgchart.js on lines 349..357

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

                                              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 (nextSib) {
                                                      if (nextSib.classList.contains('hidden')) {
                                                        rightEdge.classList.add('fa-chevron-right');
                                                        rightEdge.classList.remove('fa-chevron-left');
                                                      } else {
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 2 hrs to fix
                                              src/orgchart.js on lines 340..348

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

                                              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 ((level + 1) >= opts.verticalDepth && Number(flags.substr(2, 1))) {
                                                        let toggleBtn = document.createElement('i'),
                                                          icon = level + 1 >= opts.depth ? 'plus' : 'minus';
                                              
                                                        toggleBtn.setAttribute('class', 'toggleBtn toggleBtn-click fa fa-' + icon + '-square');
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 1523..1529

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

                                              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 (Number(flags.substr(2, 1)) && !nodeData.root) {
                                                          let toggleBtn = document.createElement('i'),
                                                            icon = level + 1 >= opts.depth ? 'plus' : 'minus';
                                              
                                                          toggleBtn.setAttribute('class', 'toggleBtn edge bottomEdge bottomEdge-click fa fa-' + icon + '-square');
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 1516..1530

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

                                              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

                                                      this._getJSON(typeof opts.ajaxURL.parent === 'function' ?
                                                        opts.ajaxURL.parent(node.dataset.source) : opts.ajaxURL.parent + nodeId)
                                                      .then(function (resp) {
                                                        if (that.chart.dataset.inAjax === 'true') {
                                                          if (Object.keys(resp).length) {
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 900..908

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

                                              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

                                                      this._getJSON(typeof opts.ajaxURL.children === 'function' ?
                                                        opts.ajaxURL.children(node.dataset.source) : opts.ajaxURL.children + nodeId)
                                                      .then(function (resp) {
                                                        if (that.chart.dataset.inAjax === 'true') {
                                                          if (resp.children.length) {
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 711..719

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

                                              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

                                                        (typeof opts.ajaxURL.families === 'function' ?
                                                          opts.ajaxURL.families(JSON.parse(node.dataset.source)) : opts.ajaxURL.families + nodeId);
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 1103..1104

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

                                              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

                                                    (event.touches[0].clientY - event.touches[1].clientY) *
                                                    (event.touches[0].clientY - event.touches[1].clientY));
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 1858..1859

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

                                              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

                                                        (typeof opts.ajaxURL.siblings === 'function' ?
                                                          opts.ajaxURL.siblings(JSON.parse(node.dataset.source)) : opts.ajaxURL.siblings + nodeId) :
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 1105..1106

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

                                              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

                                                  return Math.sqrt((event.touches[0].clientX - event.touches[1].clientX) *
                                                    (event.touches[0].clientX - event.touches[1].clientX) +
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 1860..1861

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

                                              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 (!currentRoot.querySelector(':scope > .topEdge')) {
                                                      let topEdge = document.createElement('i');
                                              
                                                      topEdge.setAttribute('class', 'edge verticalEdge topEdge fa');
                                                      currentRoot.appendChild(topEdge);
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 853..858

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

                                              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 (!node.querySelector('.bottomEdge')) {
                                                        let bottomEdge = document.createElement('i');
                                              
                                                        bottomEdge.setAttribute('class', 'edge verticalEdge bottomEdge fa');
                                                        node.appendChild(bottomEdge);
                                              Severity: Major
                                              Found in src/orgchart.js and 1 other location - About 1 hr to fix
                                              src/orgchart.js on lines 627..632

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

                                              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

                                                    const ofY = parseFloat(matrix[5] + (this.chart.clientHeight - this.chart.clientHeight * scales[scaleIndex]) / 2);
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 50 mins to fix
                                              src/orgchart.js on lines 1837..1837

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

                                              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

                                                    const ofX = parseFloat(matrix[4] + (this.chart.clientWidth - this.chart.clientWidth * scales[scaleIndex]) / 2);
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 50 mins to fix
                                              src/orgchart.js on lines 1838..1838

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

                                              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

                                                  while (nextSib) {
                                                    if (!expr || nextSib.matches(expr)) {
                                                      sibs.push(nextSib);
                                                    }
                                                    nextSib = nextSib.nextElementSibling;
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 45 mins to fix
                                              src/orgchart.js on lines 156..161

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

                                              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

                                                      } else {
                                                        if (nextSib.classList.contains('hidden')) {
                                                          this.showSiblings(node, 'right');
                                                        } else {
                                                          this.hideSiblings(node, 'right');
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 45 mins to fix
                                              src/orgchart.js on lines 1079..1085

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

                                              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 (hEdge.classList.contains('leftEdge')) {
                                                        if (prevSib.classList.contains('hidden')) {
                                                          this.showSiblings(node, 'left');
                                                        } else {
                                                          this.hideSiblings(node, 'left');
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 45 mins to fix
                                              src/orgchart.js on lines 1085..1091

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

                                              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

                                                  while (prevSib) {
                                                    if (!expr || prevSib.matches(expr)) {
                                                      sibs.push(prevSib);
                                                    }
                                                    prevSib = prevSib.previousElementSibling;
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 45 mins to fix
                                              src/orgchart.js on lines 168..173

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

                                              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

                                                  let that = this,
                                                    opts = this.options,
                                                    hEdge = event.target,
                                                    node = hEdge.parentNode,
                                                    siblingsState = this._getNodeState(node, 'siblings');
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 40 mins to fix
                                              src/orgchart.js on lines 873..877

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

                                              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

                                                  let that = this,
                                                    opts = this.options,
                                                    bottomEdge = event.target,
                                                    node = bottomEdge.parentNode,
                                                    childrenState = this._getNodeState(node, 'children');
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 40 mins to fix
                                              src/orgchart.js on lines 1058..1062

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

                                              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

                                                  let exportBtn = this.chartContainer.querySelector('.oc-export-btn' +
                                                    (opts.chartClass !== '' ? '.' + opts.chartClass : ''));
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 30 mins to fix
                                              src/orgchart.js on lines 669..670

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

                                              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

                                                  let exportBtn = this.chartContainer.querySelector('.oc-export-btn' +
                                                    (opts.chartClass !== '' ? '.' + opts.chartClass : ''));
                                              Severity: Minor
                                              Found in src/orgchart.js and 1 other location - About 30 mins to fix
                                              src/orgchart.js on lines 653..654

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

                                              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