CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/network/users.php

Summary

Maintainability
C
1 day
Test Coverage

Function confirm_delete_users has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

function confirm_delete_users( $users ) {
    $current_user = wp_get_current_user();
    if ( !is_array( $users ) )
        return false;
    ?>
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/network/users.php - About 6 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 confirm_delete_users has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function confirm_delete_users( $users ) {
    $current_user = wp_get_current_user();
    if ( !is_array( $users ) )
        return false;
    ?>
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/network/users.php - About 2 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                                    if ( is_super_admin( $user->ID ) )
                                        wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) );
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/network/users.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                          if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
                                              update_blog_status( $details->userblog_id, 'spam', '1' );
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/network/users.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if ( ! current_user_can( 'delete_users' ) )
                                            wp_die( __( 'You do not have permission to access this page.' ) );
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-admin/network/users.php - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status