CaffGeek/MBACNationals

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

Summary

Maintainability
F
2 wks
Test Coverage

File functions.php has 1808 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Main WordPress API
 *
 * @package WordPress
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 4 days to fix

    Function wp_die has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_die( $message, $title = '', $args = array() ) {
        global $wp_locale;
    
        $defaults = array( 'response' => 500 );
        $r = wp_parse_args($args, $defaults);
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 4 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

    Function wp_timezone_choice has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_timezone_choice( $selected_zone ) {
        static $mo_loaded = false;
    
        $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 4 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 wp_timezone_choice has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wp_timezone_choice( $selected_zone ) {
        static $mo_loaded = false;
    
        $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
    
    
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 3 hrs to fix

      Function add_query_arg has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      function add_query_arg() {
          $ret = '';
          if ( is_array( func_get_arg(0) ) ) {
              if ( @func_num_args() < 2 || false === @func_get_arg( 1 ) )
                  $uri = $_SERVER['REQUEST_URI'];
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/functions.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

      Function wp_explain_nonce has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function wp_explain_nonce( $action ) {
          if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) {
              $verb = $matches[1];
              $noun = $matches[2];
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/functions.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

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

      function _wp_timezone_choice_usort_callback( $a, $b ) {
          // Don't use translated versions of Etc
          if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
              // Make the order of these more like the old dropdown
              if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/functions.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

      Function do_enclose has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      function do_enclose( $content, $post_ID ) {
          global $wpdb;
          include_once( ABSPATH . WPINC . '/class-IXR.php' );
      
          $log = debug_fopen( ABSPATH . 'enclosures.log', 'a' );
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 2 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 smilies_init has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function smilies_init() {
          global $wpsmiliestrans, $wp_smiliessearch;
      
          // don't bother setting up smilies if they are disabled
          if ( !get_option( 'use_smilies' ) )
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 2 hrs to fix

        Method wp_die has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function wp_die( $message, $title = '', $args = array() ) {
            global $wp_locale;
        
            $defaults = array( 'response' => 500 );
            $r = wp_parse_args($args, $defaults);
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 2 hrs to fix

          Function get_option has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          function get_option( $setting, $default = false ) {
              global $wpdb;
          
              // Allow plugins to short-circuit options.
              $pre = apply_filters( 'pre_option_' . $setting, false );
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 2 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 get_status_header_desc has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function get_status_header_desc( $code ) {
              global $wp_header_to_desc;
          
              $code = absint( $code );
          
          
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 2 hrs to fix

            Method wp_explain_nonce has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function wp_explain_nonce( $action ) {
                if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) {
                    $verb = $matches[1];
                    $noun = $matches[2];
            
            
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 2 hrs to fix

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

              function add_query_arg() {
                  $ret = '';
                  if ( is_array( func_get_arg(0) ) ) {
                      if ( @func_num_args() < 2 || false === @func_get_arg( 1 ) )
                          $uri = $_SERVER['REQUEST_URI'];
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 2 hrs to fix

                Function wp_unique_filename has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
                    // sanitize the file name before we begin processing
                    $filename = sanitize_file_name($filename);
                
                    // separate the filename into a name and extension
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 2 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 get_allowed_mime_types has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function get_allowed_mime_types() {
                    static $mimes = false;
                
                    if ( !$mimes ) {
                        // Accepted MIME types are set here as PCRE unless provided.
                Severity: Major
                Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 2 hrs to fix

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

                  function wp_scheduled_delete() {
                      global $wpdb;
                  
                      $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
                  
                  
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/functions.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_upload_dir has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function wp_upload_dir( $time = null ) {
                      $siteurl = get_option( 'siteurl' );
                      $upload_path = get_option( 'upload_path' );
                      $upload_path = trim($upload_path);
                      if ( empty($upload_path) ) {
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/functions.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 do_enclose has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function do_enclose( $content, $post_ID ) {
                      global $wpdb;
                      include_once( ABSPATH . WPINC . '/class-IXR.php' );
                  
                      $log = debug_fopen( ABSPATH . 'enclosures.log', 'a' );
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

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

                    function wp_upload_dir( $time = null ) {
                        $siteurl = get_option( 'siteurl' );
                        $upload_path = get_option( 'upload_path' );
                        $upload_path = trim($upload_path);
                        if ( empty($upload_path) ) {
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

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

                      function wp_user_settings() {
                      
                          if ( ! is_admin() )
                              return;
                      
                      
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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 update_option has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function update_option( $option_name, $newvalue ) {
                          global $wpdb;
                      
                          wp_protect_special_option( $option_name );
                      
                      
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

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

                        function get_option( $setting, $default = false ) {
                            global $wpdb;
                        
                            // Allow plugins to short-circuit options.
                            $pre = apply_filters( 'pre_option_' . $setting, false );
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

                          Method _wp_timezone_choice_usort_callback has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function _wp_timezone_choice_usort_callback( $a, $b ) {
                              // Don't use translated versions of Etc
                              if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
                                  // Make the order of these more like the old dropdown
                                  if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

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

                            function set_site_transient($transient, $value, $expiration = 0) {
                                global $_wp_using_ext_object_cache, $wpdb;
                            
                                if ( $_wp_using_ext_object_cache ) {
                                    return wp_cache_set($transient, $value, 'site-transient', $expiration);
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/functions.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 set_transient has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function set_transient($transient, $value, $expiration = 0) {
                                global $_wp_using_ext_object_cache, $wpdb;
                            
                                if ( $_wp_using_ext_object_cache ) {
                                    return wp_cache_set($transient, $value, 'transient', $expiration);
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/functions.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 date_i18n has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
                                global $wp_locale;
                                $i = $unixtimestamp;
                                // Sanity check for PHP 5.1.0-
                                if ( false === $i || intval($i) < 0 ) {
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

                              Method wp_unique_filename has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
                                  // sanitize the file name before we begin processing
                                  $filename = sanitize_file_name($filename);
                              
                                  // separate the filename into a name and extension
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

                                Method wp_scheduled_delete has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function wp_scheduled_delete() {
                                    global $wpdb;
                                
                                    $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
                                
                                
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

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

                                  function smilies_init() {
                                      global $wpsmiliestrans, $wp_smiliessearch;
                                  
                                      // don't bother setting up smilies if they are disabled
                                      if ( !get_option( 'use_smilies' ) )
                                  Severity: Minor
                                  Found in Web.Admin/2014/wordpress/wp-includes/functions.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 is_blog_installed has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function is_blog_installed() {
                                      global $wpdb;
                                  
                                      // Check cache first. If options table goes away and we have true cached, oh well.
                                      if ( wp_cache_get( 'is_blog_installed' ) )
                                  Severity: Minor
                                  Found in Web.Admin/2014/wordpress/wp-includes/functions.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 is_blog_installed has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function is_blog_installed() {
                                      global $wpdb;
                                  
                                      // Check cache first. If options table goes away and we have true cached, oh well.
                                      if ( wp_cache_get( 'is_blog_installed' ) )
                                  Severity: Minor
                                  Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

                                    Method add_option has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
                                        global $wpdb;
                                    
                                        wp_protect_special_option( $name );
                                        $safe_name = esc_sql( $name );
                                    Severity: Minor
                                    Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 1 hr to fix

                                      Function get_all_user_settings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function get_all_user_settings() {
                                          global $_updated_user_settings;
                                      
                                          if ( ! $user = wp_get_current_user() )
                                              return array();
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 55 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 get_transient has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function get_transient($transient) {
                                          global $_wp_using_ext_object_cache, $wpdb;
                                      
                                          $pre = apply_filters( 'pre_transient_' . $transient, false );
                                          if ( false !== $pre )
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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 is_serialized has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function is_serialized( $data ) {
                                          // if it isn't a string, it isn't serialized
                                          if ( !is_string( $data ) )
                                              return false;
                                          $data = trim( $data );
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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 get_file_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function get_file_data( $file, $default_headers, $context = '' ) {
                                          // We don't need to write to the file, so just open for reading.
                                          $fp = fopen( $file, 'r' );
                                      
                                          // Pull only the first 8kiB of the file in.
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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 add_option has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
                                          global $wpdb;
                                      
                                          wp_protect_special_option( $name );
                                          $safe_name = esc_sql( $name );
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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 date_i18n has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
                                          global $wp_locale;
                                          $i = $unixtimestamp;
                                          // Sanity check for PHP 5.1.0-
                                          if ( false === $i || intval($i) < 0 ) {
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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 update_option has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function update_option( $option_name, $newvalue ) {
                                          global $wpdb;
                                      
                                          wp_protect_special_option( $option_name );
                                      
                                      
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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_ssl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function is_ssl() {
                                          if ( isset($_SERVER['HTTPS']) ) {
                                              if ( 'on' == strtolower($_SERVER['HTTPS']) )
                                                  return true;
                                              if ( '1' == $_SERVER['HTTPS'] )
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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 apache_mod_loaded has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function apache_mod_loaded($mod, $default = false) {
                                          global $is_apache;
                                      
                                          if ( !$is_apache )
                                              return false;
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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 wp_mkdir_p has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function wp_mkdir_p( $target ) {
                                          // from php.net/mkdir user contributed notes
                                          $target = str_replace( '//', '/', $target );
                                          if ( file_exists( $target ) )
                                              return @is_dir( $target );
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.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 date( $dateformatstring, $i );
                                      Severity: Major
                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return strnatcasecmp( $a['city'], $b['city'] );
                                        Severity: Major
                                        Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return strnatcasecmp( $a['t_city'], $b['t_city'] );
                                          Severity: Major
                                          Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return 1;
                                            Severity: Major
                                            Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                  return false;
                                              Severity: Major
                                              Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                    return 0;
                                                Severity: Major
                                                Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                      return apply_filters( 'option_' . $setting, maybe_unserialize( $value ) );
                                                  Severity: Major
                                                  Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
                                                    Severity: Major
                                                    Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                  return -1;
                                                      Severity: Major
                                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                    return 1;
                                                        Severity: Major
                                                        Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                          return true;
                                                          Severity: Major
                                                          Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

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

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                      return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
                                                              Severity: Major
                                                              Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                        return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
                                                                Severity: Major
                                                                Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                      return false;
                                                                  Severity: Major
                                                                  Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                        return array( 'file' => $new_file, 'url' => $url, 'error' => false );
                                                                    Severity: Major
                                                                    Found in Web.Admin/2014/wordpress/wp-includes/functions.php - About 30 mins to fix

                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                          $offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
                                                                              0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
                                                                      Severity: Major
                                                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.php and 1 other location - About 6 hrs to fix
                                                                      Web.Admin/2014/wordpress/wp-admin/options-general.php on lines 109..110

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 221.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                      function _deprecated_function($function, $version, $replacement=null) {
                                                                      
                                                                          do_action('deprecated_function_run', $function, $replacement);
                                                                      
                                                                          // Allow plugin to filter the output error trigger
                                                                      Severity: Major
                                                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.php and 1 other location - About 3 hrs to fix
                                                                      Web.Admin/2014/wordpress/wp-includes/functions.php on lines 2999..3010

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 142.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                      function _deprecated_file($file, $version, $replacement=null) {
                                                                      
                                                                          do_action('deprecated_file_included', $file, $replacement);
                                                                      
                                                                          // Allow plugin to filter the output error trigger
                                                                      Severity: Major
                                                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.php and 1 other location - About 3 hrs to fix
                                                                      Web.Admin/2014/wordpress/wp-includes/functions.php on lines 2963..2974

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 142.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                          foreach ( (array) $comments_to_delete as $comment ) {
                                                                              $comment_id = (int) $comment['comment_id'];
                                                                              if ( !$comment_id )
                                                                                  continue;
                                                                      
                                                                      
                                                                      Severity: Minor
                                                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.php and 1 other location - About 55 mins to fix
                                                                      Web.Admin/2014/wordpress/wp-includes/functions.php on lines 3538..3551

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 99.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                          foreach ( (array) $posts_to_delete as $post ) {
                                                                              $post_id = (int) $post['post_id'];
                                                                              if ( !$post_id )
                                                                                  continue;
                                                                      
                                                                      
                                                                      Severity: Minor
                                                                      Found in Web.Admin/2014/wordpress/wp-includes/functions.php and 1 other location - About 55 mins to fix
                                                                      Web.Admin/2014/wordpress/wp-includes/functions.php on lines 3555..3568

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 99.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      There are no issues that match your filters.

                                                                      Category
                                                                      Status