Web.Admin/2014/wordpress/wp-admin/network/users.php
Function confirm_delete_users
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
Open
function confirm_delete_users( $users ) {
$current_user = wp_get_current_user();
if ( !is_array( $users ) )
return false;
?>
- Read upRead up
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
Open
function confirm_delete_users( $users ) {
$current_user = wp_get_current_user();
if ( !is_array( $users ) )
return false;
?>
Avoid deeply nested control flow statements. Open
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 ) ) );
Avoid deeply nested control flow statements. Open
Open
if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
update_blog_status( $details->userblog_id, 'spam', '1' );
Avoid deeply nested control flow statements. Open
Open
if ( ! current_user_can( 'delete_users' ) )
wp_die( __( 'You do not have permission to access this page.' ) );