uccser/cs-field-guide

View on GitHub
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js

Summary

Maintainability
F
1 wk
Test Coverage

File Treant.js has 1396 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Treant-js
 *
 * Modified by UCCSER:
 * Adds fix for showing arrows on connectors after a pseudo connector.
Severity: Major
Found in csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js - About 3 days to fix

Function getPathString has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        getPathString: function (from_node, to_node, stacked) {
            var startPoint = from_node.connectorPoint(true),
                endPoint = to_node.connectorPoint(false),
                orientation = this.CONFIG.rootOrientation,
                connType = from_node.connStyle.type,

Function secondWalk has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        secondWalk: function (node, level, X, Y) {
            if (level > this.CONFIG.maxDepth) {
                return;
            }

Function positionNodes has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        positionNodes: function () {
            var self = this,
                treeSize = {
                    x: self.nodeDB.getMinMaxCoord('X', null, null),
                    y: self.nodeDB.getMinMaxCoord('Y', null, null)

Function hide has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        hide: function (collapse_to_point) {
            collapse_to_point = collapse_to_point || false;

            var bCurrentState = this.hidden;
            this.hidden = true;

Function apportion has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        apportion: function (node, level) {
            var firstChild = node.firstChild(),
                firstChildLeftNeighbor = firstChild.leftNeighbor(),
                compareDepth = 1,
                depthToStop = this.CONFIG.maxDepth - level;

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

    TreeNode.prototype.createGeometry = function (tree) {
        if (this.id === 0 && tree.CONFIG.hideRootNode) {
            this.width = 0;
            this.height = 0;
            return;

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

        reset: function (nodeStructure, tree) {

            this.db = [];

            var self = this;

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

        createNode: function (nodeStructure, parentId, tree, stackParentId) {
            var node = new TreeNode(nodeStructure, this.db.length, parentId, tree, stackParentId);

            this.db.push(node);

Function handleOverflow has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        handleOverflow: function (treeWidth, treeHeight) {
            var viewWidth = (treeWidth < this.drawArea.clientWidth) ? this.drawArea.clientWidth : treeWidth + this.CONFIG.padding * 2,
                viewHeight = (treeHeight < this.drawArea.clientHeight) ? this.drawArea.clientHeight : treeHeight + this.CONFIG.padding * 2;

            this._R.setSize(viewWidth, viewHeight);

Function firstWalk has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        firstWalk: function (node, level) {
            node.prelim = null;
            node.modifier = null;

            this.setNeighbors(node, level);

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

        positionTree: function (callback) {
            var self = this;

            if (this.imageLoader.isNotLoading()) {
                var root = this.root();

Function show has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        show: function () {
            this.hidden = false;

            this.nodeDOM.style.visibility = 'visible';

Function setConnectionToParent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        setConnectionToParent: function (treeNode, hidePoint) {
            var stacked = treeNode.stackParentId,
                connLine,
                parent = (stacked ? this.nodeDB.get(stacked) : treeNode.parent()),

Function buildNodeFromText has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    TreeNode.prototype.buildNodeFromText = function (node) {
        // IMAGE
        if (this.image) {
            image = document.createElement('img');
            image.src = this.image;

Function iterateChildren has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function iterateChildren(node, parentId) {
                var newNode = self.createNode(node, parentId, tree, null);

                if (node.children) {
                    // pseudo node is used for descending children to the next level

Function connectorPoint has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        connectorPoint: function (startPoint) {
            var orient = this.Tree().CONFIG.rootOrientation, point = {};

            if (this.stackParentId) { // return different end point if node is a stacked child
                if (orient === 'NORTH' || orient === 'SOUTH') {

Avoid deeply nested control flow statements.
Open

                        if (this.text[key].target) {
                            textElement.target = this.text[key].target;
                        }
Severity: Major
Found in csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js - About 45 mins to fix

Function reset has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        reset: function (nodeStructure, id, parentId, tree, stackParentId) {
Severity: Minor
Found in csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js - About 35 mins to fix

Function TreeNode has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    var TreeNode = function (nodeStructure, id, parentId, tree, stackParentId) {
Severity: Minor
Found in csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js - About 35 mins to fix

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

        getOuterHeight: function (element) {
            var nRoundingCompensation = 1;
            if (typeof element.getBoundingClientRect === 'function') {
                return element.getBoundingClientRect().height;
            }
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 173..191

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

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

        getOuterWidth: function (element) {
            var nRoundingCompensation = 1;
            if (typeof element.getBoundingClientRect === 'function') {
                return element.getBoundingClientRect().width;
            }
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 153..171

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

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

        showConnector: function () {
            var oTree = this.Tree();
            var oPath = oTree.connectionStore[this.id];
            if (oPath) {
                oPath.animate(
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1759..1770

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

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

        hideConnector: function () {
            var oTree = this.Tree();
            var oPath = oTree.connectionStore[this.id];
            if (oPath) {
                oPath.animate(
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1816..1827

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

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 (orientation === 'NORTH' || orientation === 'SOUTH') {
                P1.y = P2.y = (startPoint.y + endPoint.y) / 2;

                P1.x = startPoint.x;
                P2.x = endPoint.x;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 996..1001

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

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 (orientation === 'EAST' || orientation === 'WEST') {
                P1.x = P2.x = (startPoint.x + endPoint.x) / 2;

                P1.y = startPoint.y;
                P2.y = endPoint.y;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 990..1001

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

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 4 locations. Consider refactoring.
Open

                point.x = (this.pseudo) ? this.X - this.Tree().CONFIG.subTeeSeparation / 2 : this.X + this.width / 2;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1573..1573
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1582..1582
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1586..1586

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

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 4 locations. Consider refactoring.
Open

                point.y = (this.pseudo) ? this.Y - this.Tree().CONFIG.subTeeSeparation / 2 : this.Y + this.height / 2;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1573..1573
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1577..1577
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1582..1582

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

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 4 locations. Consider refactoring.
Open

                point.x = (this.pseudo) ? this.X - this.Tree().CONFIG.subTeeSeparation / 2 : this.X + this.width / 2;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1577..1577
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1582..1582
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1586..1586

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

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 4 locations. Consider refactoring.
Open

                point.y = (this.pseudo) ? this.Y - this.Tree().CONFIG.subTeeSeparation / 2 : this.Y + this.height / 2;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1573..1573
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1577..1577
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1586..1586

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

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 (orient === 'WEST' || orient === 'EAST') {
                levelHeight = this.levelMaxDim[level].width;
                nodesizeTmp = node.width;
                if (node.pseudo) {
                    node.width = levelHeight;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 690..703

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

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 (orient === 'NORTH' || orient === 'SOUTH') {
                levelHeight = this.levelMaxDim[level].height;
                nodesizeTmp = node.height;
                if (node.pseudo) {
                    node.height = levelHeight;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 697..703

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

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

        leftSibling: function () {
            var leftNeighbor = this.leftNeighbor();

            if (leftNeighbor && leftNeighbor.parentId === this.parentId) {
                return leftNeighbor;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1503..1509

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

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

        rightSibling: function () {
            var rightNeighbor = this.rightNeighbor();

            if (rightNeighbor && rightNeighbor.parentId === this.parentId) {
                return rightNeighbor;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1492..1498

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

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

            var viewWidth = (treeWidth < this.drawArea.clientWidth) ? this.drawArea.clientWidth : treeWidth + this.CONFIG.padding * 2,
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 841..841

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

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

                viewHeight = (treeHeight < this.drawArea.clientHeight) ? this.drawArea.clientHeight : treeHeight + this.CONFIG.padding * 2;
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 840..840

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

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.drawLineThrough = nodeStructure.drawLineThrough === false ? false : (nodeStructure.drawLineThrough || tree.CONFIG.node.drawLineThrough);
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1354..1354

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

            this.collapsable = nodeStructure.collapsable === false ? false : (nodeStructure.collapsable || tree.CONFIG.node.collapsable);
csfieldguide/static/interactives/tree-diagram/js/third-party/Treant.js on lines 1352..1352

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