sentilo/sentilo

View on GitHub
sentilo-catalog-web/src/main/webapp/static/js/treejs.js

Summary

Maintainability
F
1 wk
Test Coverage

Function treejs has 155 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.treejs = function( options ) {

        // get the reference of target element
        targetElement = this;

Severity: Major
Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js - About 6 hrs to fix

    Function refresh has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            refresh: function() {
                if( attributes.sourceType == 'html' )
                {
                    if( attributes.url == null )
                    {
    Severity: Major
    Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js - About 2 hrs to fix

      File treejs.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * jtree JavaScript Library v1.0
       *
       * Includes jquery.js
       * https://jquery.com/
      Severity: Minor
      Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js - About 2 hrs to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (parentIsActive === 'true') {
                                        html += '<ul class="jtree_node jtree_parent_node category-group"> <li class="category"> <span class="jtree_expand jtree_node_open category-list-icon"> </span> <label class="category-label"><input type="checkbox" id="'+ data[i]['parentNodeId'] +'" parent-id="" class="jtree_parent_checkbox category-input"> '+ data[i]['parentNodeTxt'] +'</label>';
                                        html += '<ul class="jtree_node jtree_child_node types-group">';
                    
                                        for(var j in data[i]['childNodes'])
        Severity: Major
        Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (parentIsActive === 'true') {
                                      
                                      html += '<ul class="jtree_node jtree_parent_node category-group"> <li class="category"> <span class="jtree_expand jtree_node_open category-list-icon"> </span> <label class="category-label"><input type="checkbox" id="'+ data[i]['parentNodeId'] +'" parent-id="" class="jtree_parent_checkbox category-input"> '+ data[i]['parentNodeTxt'] +'</label>';
                                      html += '<ul class="jtree_node jtree_child_node types-group">';
                  
          Severity: Major
          Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js - About 45 mins to fix

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

                    {
                        if( attributes.dataSource == null )
                        {
                            alert('Error: Missing dataSource JSON object');
                            return false;
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 2 days to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 271..315

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

            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( attributes.dataSource == null )
                            {
                                alert('Error: Missing dataSource JSON object');
                                return false;
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 2 days to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 55..100

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

            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

                            $(childUL).each(function(){
                                $(this).find('li > label').find('input[type="checkbox"]').prop('checked', false);
                                $.each($(this).find('li > label').find('input[type="checkbox"]'), (i,check) => {
                                    $(this).changeMultipleCheckboxesByMasterCheckValue(check.id, $(this).id, false);    
                                });
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 4 hrs to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 134..139

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

            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

                            $(childUL).each(function(){
                                $(this).find('li > label').find('input[type="checkbox"]').prop('checked', true);
                                $.each($(this).find('li > label').find('input[type="checkbox"]'), (i,check) => {
                                    $(this).changeMultipleCheckboxesByMasterCheckValue(check.id, $(this).id, true);    
                                });                    
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 4 hrs to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 151..156

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

            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

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

                        {
                            if( attributes.url == null )
                            {
                                alert('Error: missing ajax url');
                                return false;
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 3 hrs to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 32..52

            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

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

                    {
                        if( attributes.url == null )
                        {
                            alert('Error: missing ajax url');
                            return false;
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 3 hrs to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 249..269

            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

                    uncheckAll: function() {
                        $('.jtree_check_all_checkbox').prop('checked', '');
                        $('.jtree_parent_checkbox').prop('checked', '');
                        $('.jtree_child_checkbox').prop('checked', '');
                    },
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 1 hr to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 234..238

            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

                    checkAll: function() {
                        $('.jtree_check_all_checkbox').prop('checked', 'checked');
                        $('.jtree_parent_checkbox').prop('checked', 'checked');
                        $('.jtree_child_checkbox').prop('checked', 'checked');
                    },
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 1 hr to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 229..233

            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

                        {
                            $(this).removeClass('jtree_node_open').addClass('jtree_node_close');
                            $(this).next().next('ul').hide();
                        }
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 1 hr to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 122..125

            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

                        {
                            $(this).removeClass('jtree_node_close').addClass('jtree_node_open');
                            $(this).next().next('ul').show();
                        }
            Severity: Major
            Found in sentilo-catalog-web/src/main/webapp/static/js/treejs.js and 1 other location - About 1 hr to fix
            sentilo-catalog-web/src/main/webapp/static/js/treejs.js on lines 117..120

            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

            There are no issues that match your filters.

            Category
            Status