Showing 37 of 67 total issues
File orgchart.js
has 1620 lines of code (exceeds 250 allowed). Consider refactoring. Open
export default class OrgChart {
constructor(options) {
this._name = 'OrgChart';
Promise.prototype.finally = function (callback) {
let P = this.constructor;
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;
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,
- Read upRead up
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) {
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,
- Read upRead up
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,
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;
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) {
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) => {
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());
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';
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,
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;
- Read upRead up
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;
- Read upRead up
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') {
- Read upRead up
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());
- Read upRead up
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;
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,
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 = [];
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,