midasplatform/Midas

View on GitHub
core/public/js/layout/jquery.treeTable.js

Summary

Maintainability
F
4 days
Test Coverage

File jquery.treeTable.js has 564 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.

/* global callbackCheckboxes */
/* global callbackCreateElement */
/* global callbackCustomElements */
Severity: Major
Found in core/public/js/layout/jquery.treeTable.js - About 1 day to fix

Function ttRenderChildren has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.ttRenderChildren = function () {
        var node = $(this);
        var table = node.ttTable();
        var options = table.ttOptions();
        var elements = $.data(node[0], 'children');
Severity: Major
Found in core/public/js/layout/jquery.treeTable.js - About 3 hrs to fix

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

    $.fn.ttReloadTree = function () {
        var table = $(this);
        var options = table.ttOptions();
        table.find('tbody tr').remove();
        table.after('<img class="reloadTableIndicator" alt=""  src="' + json.global.coreWebroot + '/public/images/icons/loading.gif" />');
Severity: Major
Found in core/public/js/layout/jquery.treeTable.js - About 2 hrs to fix

Function treeTable has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.treeTable = function (opts) {
        var table = $(this);
        var options = $.extend({}, $.fn.treeTable.defaults, opts);

        // default to global callbacks in none were passed
Severity: Minor
Found in core/public/js/layout/jquery.treeTable.js - About 2 hrs to fix

Function ttInitTable has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.ttInitTable = function () {
        var table = $(this);
        var options = table.ttOptions();
        // Make visible that a row is clicked
        table.find('tbody tr').unbind('mousedown');
Severity: Minor
Found in core/public/js/layout/jquery.treeTable.js - About 1 hr to fix

Function ttFetchChildren has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.ttFetchChildren = function () {
        var node = $(this);
        if (node === undefined) {
            return;
        }
Severity: Minor
Found in core/public/js/layout/jquery.treeTable.js - About 1 hr to fix

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

    $.fn.ttInitNode = function () {
        var node = $(this);
        if (node === undefined) {
            return;
        }
Severity: Minor
Found in core/public/js/layout/jquery.treeTable.js - About 1 hr to fix

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

    $.fn.ttColorLines = function () {
        var table = $(this);
        var grey = false;
        table.find('tr').each(function (index) {
            if (index === 0) {
Severity: Minor
Found in core/public/js/layout/jquery.treeTable.js - About 1 hr to fix

Avoid deeply nested control flow statements.
Open

                            if (e.target.className != 'expander') {
                                node.toggleBranch();
                            }
Severity: Major
Found in core/public/js/layout/jquery.treeTable.js - About 45 mins to fix

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

            if (!$(this).is(':hidden')) {
                if (grey) {
                    $(this).css('background-color', '#f9f9f9');
                    $(this).hover(function () {
                        $(this).css('background-color', '#F3F1EC');
Severity: Major
Found in core/public/js/layout/jquery.treeTable.js and 1 other location - About 7 hrs to fix
modules/remoteprocessing/public/js/job/job.manage.js on lines 39..58

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

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 (!options.expandable || $(this)[0].className.search(options.childPrefix) == -1) {
                    if (isNaN(defaultPaddingLeft)) {
                        defaultPaddingLeft = parseInt($($(this).children("td:first")[options.treeColumn]).css('padding-left'), 10);
                    }
                    $(this).ttInitNode();
Severity: Major
Found in core/public/js/layout/jquery.treeTable.js and 1 other location - About 1 hr to fix
core/public/js/layout/jquery.treeTable.js on lines 390..395

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 (!options.expandable || $(this)[0].className.search(options.childPrefix) == -1) {
                    if (isNaN(defaultPaddingLeft)) {
                        defaultPaddingLeft = parseInt($($(this).children('td:first')[options.treeColumn]).css('padding-left'), 10);
                    }
                    $(this).ttInitNode();
Severity: Major
Found in core/public/js/layout/jquery.treeTable.js and 1 other location - About 1 hr to fix
core/public/js/layout/jquery.treeTable.js on lines 48..55

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

        node.ttChildren().each(function () {
            $(this).ttRemoveSubtree();
            $(this).remove();
        });
Severity: Minor
Found in core/public/js/layout/jquery.treeTable.js and 1 other location - About 50 mins to fix
core/public/js/layout/jquery.treeTable.js on lines 148..151

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

            node.ttChildren().each(function () {
                $(this).ttInitNode();
                $(this).show();
            });
Severity: Minor
Found in core/public/js/layout/jquery.treeTable.js and 1 other location - About 50 mins to fix
core/public/js/layout/jquery.treeTable.js on lines 496..499

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

There are no issues that match your filters.

Category
Status