CaffGeek/MBACNationals

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

Summary

Maintainability
F
3 days
Test Coverage

File ms.php has 471 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Multisite administration functions.
 *
 * @package WordPress
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.php - About 7 hrs to fix

    Function wpmu_delete_blog has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

    function wpmu_delete_blog( $blog_id, $drop = false ) {
        global $wpdb;
    
        $switch = false;
        if ( get_current_blog_id() != $blog_id ) {
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.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 wpmu_delete_blog has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wpmu_delete_blog( $blog_id, $drop = false ) {
        global $wpdb;
    
        $switch = false;
        if ( get_current_blog_id() != $blog_id ) {
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.php - About 2 hrs to fix

      Function wpmu_delete_user has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function wpmu_delete_user( $id ) {
          global $wpdb;
      
          $id = (int) $id;
          $user = new WP_User( $id );
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.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 choose_primary_blog has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function choose_primary_blog() {
          ?>
          <table class="form-table">
          <tr>
          <?php /* translators: My sites label */ ?>
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.php - About 1 hr to fix

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

        function send_confirmation_on_profile_email() {
            global $errors, $wpdb;
            $current_user = wp_get_current_user();
            if ( ! is_object($errors) )
                $errors = new WP_Error();
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.php - About 1 hr to fix

          Function choose_primary_blog has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function choose_primary_blog() {
              ?>
              <table class="form-table">
              <tr>
              <?php /* translators: My sites label */ ?>
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.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 wpmu_delete_user has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function wpmu_delete_user( $id ) {
              global $wpdb;
          
              $id = (int) $id;
              $user = new WP_User( $id );
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.php - About 1 hr to fix

            Method update_option_new_admin_email has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function update_option_new_admin_email( $old_value, $value ) {
                $email = get_option( 'admin_email' );
                if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
                    return;
            
            
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.php - About 1 hr to fix

              Function avoid_blog_page_permalink_collision has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function avoid_blog_page_permalink_collision( $data, $postarr ) {
                  if ( is_subdomain_install() )
                      return $data;
                  if ( $data['post_type'] != 'page' )
                      return $data;
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.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 check_upload_size has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function check_upload_size( $file ) {
                  if ( get_site_option( 'upload_space_check_disabled' ) )
                      return $file;
              
                  if ( $file['error'] != '0' ) // there's already an error
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.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

              Avoid deeply nested control flow statements.
              Open

                                  if ( $file == '.' || $file == '..' )
                                      continue;
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    else if ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) )
                                        @unlink( $dir . DIRECTORY_SEPARATOR . $file );
                Severity: Major
                Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.php - About 45 mins to fix

                  Function send_confirmation_on_profile_email has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function send_confirmation_on_profile_email() {
                      global $errors, $wpdb;
                      $current_user = wp_get_current_user();
                      if ( ! is_object($errors) )
                          $errors = new WP_Error();
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.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 upload_is_user_over_quota has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function upload_is_user_over_quota( $echo = true ) {
                      if ( get_site_option( 'upload_space_check_disabled' ) )
                          return false;
                  
                      $space_allowed = get_space_allowed();
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.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

                  Avoid too many return statements within this method.
                  Open

                      return $data;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.php - About 30 mins to fix

                    Function mu_dropdown_languages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
                        $flag = false;
                        $output = array();
                    
                        foreach ( (array) $lang_files as $val ) {
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.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 sync_category_tag_slugs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function sync_category_tag_slugs( $term, $taxonomy ) {
                        if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) {
                            if ( is_object( $term ) ) {
                                $term->slug = sanitize_title( $term->name );
                            } else {
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/includes/ms.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