CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js

Summary

Maintainability
F
6 days
Test Coverage

File nav-menu.js has 895 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * WordPress Administration Navigation Menu
 * Interface JS functions
 *
 * @version 2.0.0
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 2 days to fix

    Function jQueryExtensions has 170 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            jQueryExtensions : function() {
                // jQuery extensions
                $.fn.extend({
                    menuItemDepth : function() {
                        var margin = api.isRTL ? this.eq(0).css('margin-right') : this.eq(0).css('margin-left');
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 6 hrs to fix

      Function initSortables has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              initSortables : function() {
                  var currentDepth = 0, originalDepth, minDepth, maxDepth,
                      prev, next, prevBottom, nextThreshold, helperHeight, transport,
                      menuEdge = api.menuList.offset().left,
                      body = $('body'), maxChildDepth,
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 5 hrs to fix

        Function moveMenuItem has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                moveMenuItem : function( $this, dir ) {
        
                    var items, newItemPosition, newDepth,
                        menuItems = $( '#menu-to-edit li' ),
                        menuItemsCount = menuItems.length,
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 3 hrs to fix

          Function refreshAdvancedAccessibility has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  refreshAdvancedAccessibility : function() {
          
                      // Hide all links by default
                      $( '.menu-item-settings .field-move a' ).css( 'display', 'none' );
          
          
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 2 hrs to fix

            Function attachTabsPanelListeners has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    attachTabsPanelListeners : function() {
                        $('#menu-settings-column').bind('click', function(e) {
                            var selectAreaMatch, panelId, wrapper, items,
                                target = $(e.target);
            
            
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 2 hrs to fix

              Function getItemData has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              getItemData : function( itemType, id ) {
                                  itemType = itemType || 'menu-item';
              
                                  var itemData = {}, i,
                                  fields = [
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 1 hr to fix

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

                        refreshKeyboardAccessibility : function() {
                            $( '.item-edit' ).off( 'focus' ).on( 'focus', function(){
                                $(this).off( 'keydown' ).on( 'keydown', function(e){
                
                                    var arrows,
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 1 hr to fix

                  Function start has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  start: function(e, ui) {
                                      var height, width, parent, children, tempHolder;
                  
                                      // handle placement for rtl orientation
                                      if ( api.isRTL )
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 1 hr to fix

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

                            processQuickSearchQueryResponse : function(resp, req, panel) {
                                var matched, newID,
                                takenIDs = {},
                                form = document.getElementById('nav-menu-meta'),
                                pattern = /menu-item[(\[^]\]*/,
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 1 hr to fix

                      Avoid too many return statements within this function.
                      Open

                                              return that.eventOnClickCancelLink(e.target);
                      Severity: Major
                      Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js - About 30 mins to fix

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

                                        if ( ! isPrimaryMenuItem ) {
                                            thisLink = menuItem.find( '.menus-move-left' ),
                                            thisLinkText = menus.outFrom.replace( '%s', prevItemNameLeft );
                                            thisLink.prop( 'title', menus.moveOutFrom.replace( '%s', prevItemNameLeft ) ).html( thisLinkText ).css( 'display', 'inline' );
                                        }
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js and 1 other location - About 2 hrs to fix
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 458..462

                        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

                                            if ( menuItem.find( '.menu-item-data-parent-id' ).val() !== menuItem.prev().find( '.menu-item-data-db-id' ).val() ) {
                                                thisLink = menuItem.find( '.menus-move-right' ),
                                                thisLinkText = menus.under.replace( '%s', prevItemNameRight );
                                                thisLink.prop( 'title', menus.moveUnder.replace( '%s', prevItemNameRight ) ).html( thisLinkText ).css( 'display', 'inline' );
                                            }
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js and 1 other location - About 2 hrs to fix
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 451..455

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

                                    menu.on( 'click', '.menus-move-left', function ( e ) {
                                        api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'left' );
                                        e.preventDefault();
                                    });
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js and 3 other locations - About 1 hr to fix
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 392..395
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 396..399
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 404..407

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

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

                                    menu.on( 'click', '.menus-move-down', function ( e ) {
                                        api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'down' );
                                        e.preventDefault();
                                    });
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js and 3 other locations - About 1 hr to fix
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 396..399
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 400..403
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 404..407

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

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

                                    menu.on( 'click', '.menus-move-right', function ( e ) {
                                        api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'right' );
                                        e.preventDefault();
                                    });
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js and 3 other locations - About 1 hr to fix
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 392..395
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 396..399
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 400..403

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

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

                                    menu.on( 'click', '.menus-move-top', function ( e ) {
                                        api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'top' );
                                        e.preventDefault();
                                    });
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js and 3 other locations - About 1 hr to fix
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 392..395
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 400..403
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 404..407

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

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

                                        var hidden = $( '.accordion-container li.accordion-section' ).filter(':hidden').map(function() { return this.id; }).get().join(',');
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js and 1 other location - About 55 mins to fix
                        Web.Admin/2014/wordpress/wp-admin/js/common.dev.js on lines 138..138

                        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

                                addMenuItemToBottom : function( menuMarkup ) {
                                    $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList );
                                    api.refreshKeyboardAccessibility();
                                    api.refreshAdvancedAccessibility();
                                },
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js and 1 other location - About 55 mins to fix
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 944..948

                        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

                                addMenuItemToTop : function( menuMarkup ) {
                                    $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList );
                                    api.refreshKeyboardAccessibility();
                                    api.refreshAdvancedAccessibility();
                                },
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js and 1 other location - About 55 mins to fix
                        Web.Admin/2014/wordpress/wp-admin/js/nav-menu.js on lines 938..942

                        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