CaffGeek/MBACNationals

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

Summary

Maintainability
D
3 days
Test Coverage

Function _bind has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    final protected function _bind() {
        if ( $this->bound )
            return;

        // Add the root node.
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - About 5 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

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

<?php
/**
 * The WordPress Toolbar
 *
 * @since 3.1.0
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - About 4 hrs to fix

    Method _bind has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        final protected function _bind() {
            if ( $this->bound )
                return;
    
            // Add the root node.
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - About 3 hrs to fix

      Function _render_item has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          final protected function _render_item( $node ) {
              if ( $node->type != 'item' )
                  return;
      
              $is_parent = ! empty( $node->children );
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - 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

      Method _render_item has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          final protected function _render_item( $node ) {
              if ( $node->type != 'item' )
                  return;
      
              $is_parent = ! empty( $node->children );
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - About 2 hrs to fix

        WP_Admin_Bar has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class WP_Admin_Bar {
            private $nodes = array();
            private $bound = false;
            public $user;
        
        
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - About 2 hrs to fix

          Method add_node has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function add_node( $args ) {
                  // Shim for old method signature: add_node( $parent_id, $menu_obj, $args )
                  if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) )
                      $args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(2) );
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - About 1 hr to fix

            Function add_node has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public function add_node( $args ) {
                    // Shim for old method signature: add_node( $parent_id, $menu_obj, $args )
                    if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) )
                        $args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(2) );
            
            
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/class-wp-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 _render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                final protected function _render( $root ) {
                    global $is_IE;
            
                    // Add browser classes.
                    // We have to do this here since admin bar shows on the front end.
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function initialize() {
                    $this->user = new stdClass;
            
                    if ( is_user_logged_in() ) {
                        /* Populate settings we need for the menu based on the current user. */
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - About 25 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 _render_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                final protected function _render_group( $node ) {
                    if ( $node->type == 'container' )
                        return $this->_render_container( $node );
            
                    if ( $node->type != 'group' || empty( $node->children ) )
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/class-wp-admin-bar.php - About 25 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