mar10/fancytree

View on GitHub
lib/contextmenu-abs/jquery.contextMenu-custom.js

Summary

Maintainability
F
5 days
Test Coverage

Function contextMenu has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        contextMenu: function(o, callback) {
            // Defaults
            if( o.menu == undefined ) return false;
            if( o.inSpeed == undefined ) o.inSpeed = 150;
            if( o.outSpeed == undefined ) o.outSpeed = 75;
Severity: Major
Found in lib/contextmenu-abs/jquery.contextMenu-custom.js - About 4 hrs to fix

    Consider simplifying this complex logical expression.
    Open

    if(jQuery)( function() {
    
        /* Check browser version, since $.browser was removed in jQuery 1.9 */
        function _checkBrowser(){
            var matched, browser;
    Severity: Critical
    Found in lib/contextmenu-abs/jquery.contextMenu-custom.js - About 2 hrs to fix

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

          function _checkBrowser(){
              var matched, browser;
              function uaMatch( ua ) {
                  ua = ua.toLowerCase();
                  var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
      Severity: Minor
      Found in lib/contextmenu-abs/jquery.contextMenu-custom.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                                    if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:last').addClass('hover');
        Severity: Major
        Found in lib/contextmenu-abs/jquery.contextMenu-custom.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                                      if( $(menu).find('LI.hover').size() == 0 ) $(menu).find('LI:first').addClass('hover');
          Severity: Major
          Found in lib/contextmenu-abs/jquery.contextMenu-custom.js - About 45 mins to fix

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

                    disableContextMenuItems: function(o) {
                        if( o == undefined ) {
                            // Disable all
                            $(this).find('LI').addClass('disabled');
                            return( $(this) );
            Severity: Major
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 7 hrs to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 211..227

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

            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

                    enableContextMenuItems: function(o) {
                        if( o == undefined ) {
                            // Enable all
                            $(this).find('LI.disabled').removeClass('disabled');
                            return( $(this) );
            Severity: Major
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 7 hrs to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 192..208

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

            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

                                                case 38: // up
                                                    if( $(menu).find('LI.hover').size() == 0 ) {
                                                        $(menu).find('LI:last').addClass('hover');
                                                    } else {
                                                        $(menu).find('LI.hover').removeClass('hover').prevAll('LI:not(.disabled)').eq(0).addClass('hover');
            Severity: Major
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 6 hrs to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 137..144

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

            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

                                                case 40: // down
                                                    if( $(menu).find('LI.hover').size() == 0 ) {
                                                        $(menu).find('LI:first').addClass('hover');
                                                    } else {
                                                        $(menu).find('LI.hover').removeClass('hover').nextAll('LI:not(.disabled)').eq(0).addClass('hover');
            Severity: Major
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 6 hrs to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 129..136

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

            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( document.body ) {
                                            d.pageYOffset = document.body.scrollTop;
                                            d.pageXOffset = document.body.scrollLeft;
                                            d.innerHeight = document.body.clientHeight;
                                            d.innerWidth = document.body.clientWidth;
            Severity: Major
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 2 hrs to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 98..109

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

            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( document.documentElement &&
                                            document.documentElement.clientHeight ) {
                                            d.pageYOffset = document.documentElement.scrollTop;
                                            d.pageXOffset = document.documentElement.scrollLeft;
                                            d.innerHeight = document.documentElement.clientHeight;
            Severity: Major
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 2 hrs to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 104..109

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

            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( BROWSER.msie ) {
                                $('#' + o.menu).each( function() { $(this).bind('selectstart.disableTextSelect', function() { return false; }); });
                            } else {
            Severity: Major
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 1 hr to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 181..183

            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

                            } else {
                                $('#' + o.menu).each(function() { $(this).bind('mousedown.disableTextSelect', function() { return false; }); });
                            }
            Severity: Major
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 1 hr to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 179..181

            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

                    disableContextMenu: function() {
                        $(this).each( function() {
                            $(this).addClass('disabled');
                        });
                        return( $(this) );
            Severity: Minor
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 55 mins to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 238..243

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

            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

                    enableContextMenu: function() {
                        $(this).each( function() {
                            $(this).removeClass('disabled');
                        });
                        return( $(this) );
            Severity: Minor
            Found in lib/contextmenu-abs/jquery.contextMenu-custom.js and 1 other location - About 55 mins to fix
            lib/contextmenu-abs/jquery.contextMenu-custom.js on lines 230..235

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

            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