Showing 67 of 67 total issues
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
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');
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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');
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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,
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) {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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) {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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;
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,
- 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 _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;
- 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 _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,
- 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 _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)'),
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)) {