MiraitSystems/enju_trunk

View on GitHub
app/assets/javascripts/fg.menu.js

Summary

Maintainability
F
1 wk
Test Coverage

File fg.menu.js has 494 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*-------------------------------------------------------------------- 
Scripts for creating and manipulating custom menus based on standard <ul> markup
Version: 3.0, 03.31.2009

By: Maggie Costello Wachs (maggie@filamentgroup.com) and Scott Jehl (scott@filamentgroup.com)
Severity: Minor
Found in app/assets/javascripts/fg.menu.js - About 7 hrs to fix

    Function Menu has 188 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Menu(caller, options){
        var menu = this;
        var caller = $(caller);
        var container = $('<div class="fg-menu-container ui-widget ui-widget-content ui-corner-all">'+options.content+'</div>');
        
    Severity: Major
    Found in app/assets/javascripts/fg.menu.js - About 7 hrs to fix

      Function drilldown has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Menu.prototype.drilldown = function(container, options) {
          var menu = this;    
          var topList = container.find('.fg-menu');    
          var breadcrumb = $('<ul class="fg-menu-breadcrumb ui-widget-header ui-corner-all ui-helper-clearfix"></ul>');
          var crumbDefaultHeader = $('<li class="fg-menu-breadcrumb-text">'+options.crumbDefaultText+'</li>');
      Severity: Major
      Found in app/assets/javascripts/fg.menu.js - About 4 hrs to fix

        Function Menu has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        function Menu(caller, options){
            var menu = this;
            var caller = $(caller);
            var container = $('<div class="fg-menu-container ui-widget ui-widget-content ui-corner-all">'+options.content+'</div>');
            
        Severity: Minor
        Found in app/assets/javascripts/fg.menu.js - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function showMenu has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.showMenu = function(){
                killAllMenus();
                if (!menu.menuExists) { menu.create() };
                caller
                    .addClass('fg-menu-open')
        Severity: Major
        Found in app/assets/javascripts/fg.menu.js - About 3 hrs to fix

          Function setPosition has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Menu.prototype.setPosition = function(widget, caller, options) { 
              var el = widget;
              var referrer = caller;
              var dims = {
                  refX: referrer.offset().left,
          Severity: Major
          Found in app/assets/javascripts/fg.menu.js - About 2 hrs to fix

            Function setPosition has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            Menu.prototype.setPosition = function(widget, caller, options) { 
                var el = widget;
                var referrer = caller;
                var dims = {
                    refX: referrer.offset().left,
            Severity: Minor
            Found in app/assets/javascripts/fg.menu.js - About 2 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function flyout has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Menu.prototype.flyout = function(container, options) {
                var menu = this;
                
                this.resetFlyoutMenu = function(){
                    var allLists = container.find('ul ul');
            Severity: Minor
            Found in app/assets/javascripts/fg.menu.js - About 1 hr to fix

              Function create has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  this.create = function(){    
                      container.css({ width: options.width }).appendTo('body').find('ul:first').not('.fg-menu-breadcrumb').addClass('fg-menu');
                      container.find('ul, li a').addClass('ui-corner-all');
                      
                      // aria roles & attributes
              Severity: Minor
              Found in app/assets/javascripts/fg.menu.js - About 1 hr to fix

                Function drilldown has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                Menu.prototype.drilldown = function(container, options) {
                    var menu = this;    
                    var topList = container.find('.fg-menu');    
                    var breadcrumb = $('<ul class="fg-menu-breadcrumb ui-widget-header ui-corner-all ui-helper-clearfix"></ul>');
                    var crumbDefaultHeader = $('<li class="fg-menu-breadcrumb-text">'+options.crumbDefaultText+'</li>');
                Severity: Minor
                Found in app/assets/javascripts/fg.menu.js - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function pxToEm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                Number.prototype.pxToEm = String.prototype.pxToEm = function(settings){
                    //set defaults
                    settings = $.extend({
                        scope: 'body',
                        reverse: false
                Severity: Minor
                Found in app/assets/javascripts/fg.menu.js - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                    if (options.positionOpts.directionV == 'up') {
                        el.css({ top: 'auto', bottom: yVal });
                        if (options.positionOpts.detectV && !fitVertical(el)) {
                            el.css({ bottom: 'auto', top: yVal });
                        }
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 6 hrs to fix
                app/assets/javascripts/fg.menu.js on lines 517..528

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

                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.positionOpts.directionH == 'left') {
                        el.css({ left: 'auto', right: xVal });
                        if (options.positionOpts.detectH && !fitHorizontal(el)) {
                            el.css({ right: 'auto', left: xVal });
                        }
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 6 hrs to fix
                app/assets/javascripts/fg.menu.js on lines 503..514

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

                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 arrow 
                                    if ($(event.target).is('.' + options.linkHover)) {    
                                        var prevLink = $(event.target).parent().prev().find('a:eq(0)');                        
                                        if (prevLink.size() > 0) {
                                            $(event.target).trigger('mouseout');
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 5 hrs to fix
                app/assets/javascripts/fg.menu.js on lines 165..175

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

                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 arrow 
                                    if ($(event.target).is('.' + options.linkHover)) {
                                        var nextLink = $(event.target).parent().next().find('a:eq(0)');                        
                                        if (nextLink.size() > 0) {                            
                                            $(event.target).trigger('mouseout');
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 5 hrs to fix
                app/assets/javascripts/fg.menu.js on lines 138..148

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

                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

                $.fn.getTotalWidth = function(){
                    return $(this).width() + parseInt($(this).css('paddingRight')) + parseInt($(this).css('paddingLeft')) + parseInt($(this).css('borderRightWidth')) + parseInt($(this).css('borderLeftWidth'));
                };
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/fg.menu.js on lines 553..555

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

                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

                $.fn.getTotalHeight = function(){
                    return $(this).height() + parseInt($(this).css('paddingTop')) + parseInt($(this).css('paddingBottom')) + parseInt($(this).css('borderTopWidth')) + parseInt($(this).css('borderBottomWidth'));
                };
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/fg.menu.js on lines 549..551

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

                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

                function fitHorizontal(el, leftOffset){
                    var leftVal = parseInt(leftOffset) || $(el).offset().left;
                    return (leftVal + $(el).width() <= getWindowWidth() + getScrollLeft() && leftVal - getScrollLeft() >= 0);
                };
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/fg.menu.js on lines 585..588

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

                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

                function fitVertical(el, topOffset){
                    var topVal = parseInt(topOffset) || $(el).offset().top;
                    return (topVal + $(el).height() <= getWindowHeight() + getScrollTop() && topVal - getScrollTop() >= 0);
                };
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/fg.menu.js on lines 580..583

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

                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 ($(event.target).is('.fg-menu-indicator') && menuType == 'ipod') {                            
                                        $(event.target).trigger('click');                        
                                        setTimeout(function(){
                                            $(event.target).next().find('a:eq(0)').trigger('mouseover');
                                        }, options.crossSpeed);                    
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/fg.menu.js on lines 155..160

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

                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

                                        else if (menuType == 'ipod') {
                                            $(event.target).trigger('click');                        
                                            setTimeout(function(){
                                                $(event.target).next().find('a:eq(0)').trigger('mouseover');
                                            }, options.crossSpeed);
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/fg.menu.js on lines 182..187

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

                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

                    switch(options.positionOpts.posX) {
                        case 'left':     xVal = 0; 
                            break;                
                        case 'center': xVal = dims.refW / 2;
                            break;                
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/fg.menu.js on lines 489..496

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

                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

                    switch(options.positionOpts.posY) {
                        case 'top':     yVal = 0;
                            break;                
                        case 'center': yVal = dims.refH / 2;
                            break;                
                Severity: Major
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/fg.menu.js on lines 479..486

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

                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

                function getWindowHeight(){
                    var de = document.documentElement;
                    return self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
                };
                Severity: Minor
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 45 mins to fix
                app/assets/javascripts/fg.menu.js on lines 570..573

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

                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

                function getWindowWidth(){
                    var de = document.documentElement;
                    return self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
                };
                Severity: Minor
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 45 mins to fix
                app/assets/javascripts/fg.menu.js on lines 565..568

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

                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

                                hideTimer = setTimeout(function(){
                                    subList.removeClass('ui-widget-content').hide(options.showSpeed).attr('aria-expanded', 'false');
                                }, 400);    
                Severity: Minor
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 40 mins to fix
                app/assets/javascripts/fg.menu.js on lines 273..275

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

                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

                                showTimer = setTimeout(function(){
                                    subList.addClass('ui-widget-content').show(options.showSpeed).attr('aria-expanded', 'true');    
                                }, 300);    
                Severity: Minor
                Found in app/assets/javascripts/fg.menu.js and 1 other location - About 40 mins to fix
                app/assets/javascripts/fg.menu.js on lines 280..282

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

                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