CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/admin-bar.php

Summary

Maintainability
F
3 days
Test Coverage

File admin-bar.php has 520 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Admin Bar
 *
 * This code handles the building and rendering of the press bar.
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 day to fix

    Method wp_admin_bar_my_sites_menu has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
        // Don't show for logged out users or single site mode.
        if ( ! is_user_logged_in() || ! is_multisite() )
            return;
    
    
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 3 hrs to fix

      Method wp_admin_bar_edit_menu has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function wp_admin_bar_edit_menu( $wp_admin_bar ) {
          global $tag, $wp_the_query;
      
          if ( is_admin() ) {
              $current_screen = get_current_screen();
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                if ( 'post' == $current_screen->base
                    && 'add' != $current_screen->action
                    && ( $post_type_object = get_post_type_object( $post->post_type ) )
                    && current_user_can( 'read_post', $post->ID )
                    && ( $post_type_object->public )
        Severity: Critical
        Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 2 hrs to fix

          Function wp_admin_bar_new_content_menu has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
              $actions = array();
          
              $cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' );
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 hr 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

          Method wp_admin_bar_site_menu has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function wp_admin_bar_site_menu( $wp_admin_bar ) {
              // Don't show for logged out users.
              if ( ! is_user_logged_in() )
                  return;
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 hr to fix

            Method wp_admin_bar_new_content_menu has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
                $actions = array();
            
                $cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' );
            
            
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 hr to fix

              Method wp_admin_bar_wp_menu has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function wp_admin_bar_wp_menu( $wp_admin_bar ) {
                  $wp_admin_bar->add_menu( array(
                      'id'    => 'wp-logo',
                      'title' => '<span class="ab-icon"></span>',
                      'href'  => self_admin_url( 'about.php' ),
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 hr to fix

                Method wp_admin_bar_my_account_menu has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
                    $user_id      = get_current_user_id();
                    $current_user = wp_get_current_user();
                    $profile_url  = get_edit_profile_url( $user_id );
                
                
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ( ! empty( $current_object->post_type )
                              && ( $post_type_object = get_post_type_object( $current_object->post_type ) )
                              && current_user_can( 'edit_post', $current_object->ID )
                              && $post_type_object->show_ui && $post_type_object->show_in_admin_bar )
                          {
                  Severity: Critical
                  Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 hr to fix

                    Function wp_admin_bar_edit_menu has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function wp_admin_bar_edit_menu( $wp_admin_bar ) {
                        global $tag, $wp_the_query;
                    
                        if ( is_admin() ) {
                            $current_screen = get_current_screen();
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 hr 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 wp_admin_bar_my_sites_menu has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
                        // Don't show for logged out users or single site mode.
                        if ( ! is_user_logged_in() || ! is_multisite() )
                            return;
                    
                    
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 hr 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 wp_admin_bar_site_menu has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function wp_admin_bar_site_menu( $wp_admin_bar ) {
                        // Don't show for logged out users.
                        if ( ! is_user_logged_in() )
                            return;
                    
                    
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 1 hr 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 wp_admin_bar_appearance_menu has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
                        $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) );
                    
                        if ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
                            $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __('Themes'), 'href' => admin_url('themes.php') ) );
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 35 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 is_admin_bar_showing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function is_admin_bar_showing() {
                        global $show_admin_bar, $pagenow;
                    
                        // For all these types of requests, we never want an admin bar.
                        if ( defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') )
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/admin-bar.php - About 35 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

                    There are no issues that match your filters.

                    Category
                    Status