WordPress/WordPress

View on GitHub
wp-includes/comment.php

Summary

Maintainability
F
3 wks
Test Coverage

File comment.php has 1794 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Core Comment API
 *
 * @package WordPress
Severity: Major
Found in wp-includes/comment.php - About 4 days to fix

    Function check_comment has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

    function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type ) {
        global $wpdb;
    
        // If manual moderation is enabled, skip all checks and return false.
        if ( 1 == get_option( 'comment_moderation' ) ) {
    Severity: Minor
    Found in wp-includes/comment.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

    Function wp_handle_comment_submission has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_handle_comment_submission( $comment_data ) {
        $comment_post_id      = 0;
        $comment_author       = '';
        $comment_author_email = '';
        $comment_author_url   = '';
    Severity: Minor
    Found in wp-includes/comment.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 wp_handle_comment_submission has 125 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wp_handle_comment_submission( $comment_data ) {
        $comment_post_id      = 0;
        $comment_author       = '';
        $comment_author_email = '';
        $comment_author_url   = '';
    Severity: Major
    Found in wp-includes/comment.php - About 5 hrs to fix

      Function get_page_of_comment has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      function get_page_of_comment( $comment_id, $args = array() ) {
          global $wpdb;
      
          $page = null;
      
      
      Severity: Minor
      Found in wp-includes/comment.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_update_comment has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      function wp_update_comment( $commentarr, $wp_error = false ) {
          global $wpdb;
      
          // First, get all of the original fields.
          $comment = get_comment( $commentarr['comment_ID'], ARRAY_A );
      Severity: Minor
      Found in wp-includes/comment.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 pingback has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      function pingback( $content, $post ) {
          require_once ABSPATH . WPINC . '/class-IXR.php';
          require_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
      
          // Original code by Mort (http://mort.mine.nu:8080).
      Severity: Minor
      Found in wp-includes/comment.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 wp_allow_comment has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function wp_allow_comment( $commentdata, $wp_error = false ) {
          global $wpdb;
      
          /*
           * Simple duplicate check.
      Severity: Major
      Found in wp-includes/comment.php - About 3 hrs to fix

        Method wp_update_comment has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function wp_update_comment( $commentarr, $wp_error = false ) {
            global $wpdb;
        
            // First, get all of the original fields.
            $comment = get_comment( $commentarr['comment_ID'], ARRAY_A );
        Severity: Major
        Found in wp-includes/comment.php - About 3 hrs to fix

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

          function wp_new_comment( $commentdata, $wp_error = false ) {
              global $wpdb;
          
              /*
               * Normalize `user_ID` to `user_id`, but pass the old key
          Severity: Minor
          Found in wp-includes/comment.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 get_page_of_comment has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function get_page_of_comment( $comment_id, $args = array() ) {
              global $wpdb;
          
              $page = null;
          
          
          Severity: Major
          Found in wp-includes/comment.php - About 2 hrs to fix

            Method wp_comments_personal_data_exporter has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function wp_comments_personal_data_exporter( $email_address, $page = 1 ) {
                // Limit us to 500 comments at a time to avoid timing out.
                $number = 500;
                $page   = (int) $page;
            
            
            Severity: Major
            Found in wp-includes/comment.php - About 2 hrs to fix

              Function wp_allow_comment has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              function wp_allow_comment( $commentdata, $wp_error = false ) {
                  global $wpdb;
              
                  /*
                   * Simple duplicate check.
              Severity: Minor
              Found in wp-includes/comment.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

              Function wp_get_comment_fields_max_lengths has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              function wp_get_comment_fields_max_lengths() {
                  global $wpdb;
              
                  $lengths = array(
                      'comment_author'       => 245,
              Severity: Minor
              Found in wp-includes/comment.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 wp_new_comment has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function wp_new_comment( $commentdata, $wp_error = false ) {
                  global $wpdb;
              
                  /*
                   * Normalize `user_ID` to `user_id`, but pass the old key
              Severity: Major
              Found in wp-includes/comment.php - About 2 hrs to fix

                Method wp_comments_personal_data_eraser has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function wp_comments_personal_data_eraser( $email_address, $page = 1 ) {
                    global $wpdb;
                
                    if ( empty( $email_address ) ) {
                        return array(
                Severity: Major
                Found in wp-includes/comment.php - About 2 hrs to fix

                  Method check_comment has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type ) {
                      global $wpdb;
                  
                      // If manual moderation is enabled, skip all checks and return false.
                      if ( 1 == get_option( 'comment_moderation' ) ) {
                  Severity: Major
                  Found in wp-includes/comment.php - About 2 hrs to fix

                    Method discover_pingback_server_uri has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function discover_pingback_server_uri( $url, $deprecated = '' ) {
                        if ( ! empty( $deprecated ) ) {
                            _deprecated_argument( __FUNCTION__, '2.7.0' );
                        }
                    
                    
                    Severity: Major
                    Found in wp-includes/comment.php - About 2 hrs to fix

                      Method wp_insert_comment has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function wp_insert_comment( $commentdata ) {
                          global $wpdb;
                      
                          $data = wp_unslash( $commentdata );
                      
                      
                      Severity: Major
                      Found in wp-includes/comment.php - About 2 hrs to fix

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

                        function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) {
                            global $wpdb;
                        
                            // Another callback has declared a flood. Trust it.
                            if ( true === $is_flood ) {
                        Severity: Minor
                        Found in wp-includes/comment.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 pingback has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function pingback( $content, $post ) {
                            require_once ABSPATH . WPINC . '/class-IXR.php';
                            require_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
                        
                            // Original code by Mort (http://mort.mine.nu:8080).
                        Severity: Minor
                        Found in wp-includes/comment.php - About 1 hr to fix

                          Method _wp_batch_update_comment_type has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function _wp_batch_update_comment_type() {
                              global $wpdb;
                          
                              $lock_name = 'update_comment_type.lock';
                          
                          
                          Severity: Minor
                          Found in wp-includes/comment.php - About 1 hr to fix

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

                            function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) {
                                global $wpdb;
                            
                                // Another callback has declared a flood. Trust it.
                                if ( true === $is_flood ) {
                            Severity: Minor
                            Found in wp-includes/comment.php - About 1 hr to fix

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

                              function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {
                                  global $wp_query;
                              
                                  if ( null === $comments && null === $per_page && null === $threaded && ! empty( $wp_query->max_num_comment_pages ) ) {
                                      return $wp_query->max_num_comment_pages;
                              Severity: Minor
                              Found in wp-includes/comment.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_comments_personal_data_eraser has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function wp_comments_personal_data_eraser( $email_address, $page = 1 ) {
                                  global $wpdb;
                              
                                  if ( empty( $email_address ) ) {
                                      return array(
                              Severity: Minor
                              Found in wp-includes/comment.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_trackbacks has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function do_trackbacks( $post ) {
                                  global $wpdb;
                              
                                  $post = get_post( $post );
                              
                              
                              Severity: Minor
                              Found in wp-includes/comment.php - About 1 hr to fix

                                Method wp_set_comment_status has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function wp_set_comment_status( $comment_id, $comment_status, $wp_error = false ) {
                                    global $wpdb;
                                
                                    switch ( $comment_status ) {
                                        case 'hold':
                                Severity: Minor
                                Found in wp-includes/comment.php - About 1 hr to fix

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

                                  function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {
                                      global $wp_query;
                                  
                                      if ( null === $comments && null === $per_page && null === $threaded && ! empty( $wp_query->max_num_comment_pages ) ) {
                                          return $wp_query->max_num_comment_pages;
                                  Severity: Minor
                                  Found in wp-includes/comment.php - About 1 hr to fix

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

                                    function get_comment_count( $post_id = 0 ) {
                                        $post_id = (int) $post_id;
                                    
                                        $comment_count = array(
                                            'approved'            => 0,
                                    Severity: Minor
                                    Found in wp-includes/comment.php - About 1 hr to fix

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

                                      function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ) {
                                          /**
                                           * Fires before the comment is tested for disallowed characters or words.
                                           *
                                           * @since 1.5.0
                                      Severity: Minor
                                      Found in wp-includes/comment.php - About 1 hr to fix

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

                                        function discover_pingback_server_uri( $url, $deprecated = '' ) {
                                            if ( ! empty( $deprecated ) ) {
                                                _deprecated_argument( __FUNCTION__, '2.7.0' );
                                            }
                                        
                                        
                                        Severity: Minor
                                        Found in wp-includes/comment.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 do_trackbacks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function do_trackbacks( $post ) {
                                            global $wpdb;
                                        
                                            $post = get_post( $post );
                                        
                                        
                                        Severity: Minor
                                        Found in wp-includes/comment.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 wp_delete_comment has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        function wp_delete_comment( $comment_id, $force_delete = false ) {
                                            global $wpdb;
                                        
                                            $comment = get_comment( $comment_id );
                                            if ( ! $comment ) {
                                        Severity: Minor
                                        Found in wp-includes/comment.php - About 1 hr to fix

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

                                          function wp_get_comment_fields_max_lengths() {
                                              global $wpdb;
                                          
                                              $lengths = array(
                                                  'comment_author'       => 245,
                                          Severity: Minor
                                          Found in wp-includes/comment.php - About 1 hr to fix

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

                                            function wp_comments_personal_data_exporter( $email_address, $page = 1 ) {
                                                // Limit us to 500 comments at a time to avoid timing out.
                                                $number = 500;
                                                $page   = (int) $page;
                                            
                                            
                                            Severity: Minor
                                            Found in wp-includes/comment.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

                                            Consider simplifying this complex logical expression.
                                            Open

                                                    if ( preg_match( $pattern, $author )
                                                        || preg_match( $pattern, $email )
                                                        || preg_match( $pattern, $url )
                                                        || preg_match( $pattern, $comment )
                                                        || preg_match( $pattern, $comment_without_html )
                                            Severity: Major
                                            Found in wp-includes/comment.php - About 1 hr to fix

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

                                              function get_comment( $comment = null, $output = OBJECT ) {
                                                  if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) {
                                                      $comment = $GLOBALS['comment'];
                                                  }
                                              
                                              
                                              Severity: Minor
                                              Found in wp-includes/comment.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 wp_set_comment_status has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              function wp_set_comment_status( $comment_id, $comment_status, $wp_error = false ) {
                                                  global $wpdb;
                                              
                                                  switch ( $comment_status ) {
                                                      case 'hold':
                                              Severity: Minor
                                              Found in wp-includes/comment.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

                                              Method check_comment has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                              function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type ) {
                                              Severity: Major
                                              Found in wp-includes/comment.php - About 50 mins to fix

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

                                                function wp_get_unapproved_comment_author_email() {
                                                    $commenter_email = '';
                                                
                                                    if ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) {
                                                        $comment_id = (int) $_GET['unapproved'];
                                                Severity: Minor
                                                Found in wp-includes/comment.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

                                                Method wp_check_comment_disallowed_list has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ) {
                                                Severity: Minor
                                                Found in wp-includes/comment.php - About 45 mins to fix

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

                                                  function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ) {
                                                      /**
                                                       * Fires before the comment is tested for disallowed characters or words.
                                                       *
                                                       * @since 1.5.0
                                                  Severity: Minor
                                                  Found in wp-includes/comment.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 wp_insert_comment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  function wp_insert_comment( $commentdata ) {
                                                      global $wpdb;
                                                  
                                                      $data = wp_unslash( $commentdata );
                                                  
                                                  
                                                  Severity: Minor
                                                  Found in wp-includes/comment.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

                                                  Method wp_check_comment_flood has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                  function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) {
                                                  Severity: Minor
                                                  Found in wp-includes/comment.php - About 35 mins to fix

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

                                                    function wp_delete_comment( $comment_id, $force_delete = false ) {
                                                        global $wpdb;
                                                    
                                                        $comment = get_comment( $comment_id );
                                                        if ( ! $comment ) {
                                                    Severity: Minor
                                                    Found in wp-includes/comment.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_update_comment_count has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                    function wp_update_comment_count( $post_id, $do_deferred = false ) {
                                                        static $_deferred = array();
                                                    
                                                        if ( empty( $post_id ) && ! $do_deferred ) {
                                                            return false;
                                                    Severity: Minor
                                                    Found in wp-includes/comment.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_get_comment_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                    function wp_get_comment_status( $comment_id ) {
                                                        $comment = get_comment( $comment_id );
                                                        if ( ! $comment ) {
                                                            return false;
                                                        }
                                                    Severity: Minor
                                                    Found in wp-includes/comment.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 false;
                                                    Severity: Major
                                                    Found in wp-includes/comment.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                      return false;
                                                      Severity: Major
                                                      Found in wp-includes/comment.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                            return false;
                                                        Severity: Major
                                                        Found in wp-includes/comment.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                              return $result;
                                                          Severity: Major
                                                          Found in wp-includes/comment.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        return false;
                                                            Severity: Major
                                                            Found in wp-includes/comment.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                          return new WP_Error( 'db_update_error', __( 'Could not update comment in the database.' ), $wpdb->last_error );
                                                              Severity: Major
                                                              Found in wp-includes/comment.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                    return (int) $count;
                                                                Severity: Major
                                                                Found in wp-includes/comment.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                      return true;
                                                                  Severity: Major
                                                                  Found in wp-includes/comment.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                            return false;
                                                                    Severity: Major
                                                                    Found in wp-includes/comment.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                      return false;
                                                                      Severity: Major
                                                                      Found in wp-includes/comment.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                            return $_comment;
                                                                        Severity: Major
                                                                        Found in wp-includes/comment.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                  return false;
                                                                          Severity: Major
                                                                          Found in wp-includes/comment.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                    return false;
                                                                            Severity: Major
                                                                            Found in wp-includes/comment.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                      return new WP_Error( 'comment_on_trash' );
                                                                              Severity: Major
                                                                              Found in wp-includes/comment.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                            return $data;
                                                                                Severity: Major
                                                                                Found in wp-includes/comment.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                          return false;
                                                                                  Severity: Major
                                                                                  Found in wp-includes/comment.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                    return false;
                                                                                    Severity: Major
                                                                                    Found in wp-includes/comment.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                          return true;
                                                                                      Severity: Major
                                                                                      Found in wp-includes/comment.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                    return $pingback_server_url;
                                                                                        Severity: Major
                                                                                        Found in wp-includes/comment.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                          return false;
                                                                                          Severity: Major
                                                                                          Found in wp-includes/comment.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                return $open;
                                                                                            Severity: Major
                                                                                            Found in wp-includes/comment.php - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                          return false;
                                                                                              Severity: Major
                                                                                              Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                        return $open;
                                                                                                Severity: Major
                                                                                                Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

                                                                                                          return 'spam';
                                                                                                  Severity: Major
                                                                                                  Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                    Avoid too many return statements within this method.
                                                                                                    Open

                                                                                                            return 'trash';
                                                                                                    Severity: Major
                                                                                                    Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                      Avoid too many return statements within this method.
                                                                                                      Open

                                                                                                          return true;
                                                                                                      Severity: Major
                                                                                                      Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                        Avoid too many return statements within this method.
                                                                                                        Open

                                                                                                                    return false;
                                                                                                        Severity: Major
                                                                                                        Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                          Avoid too many return statements within this method.
                                                                                                          Open

                                                                                                                  return new WP_Error( 'comment_save_error', __( '<strong>Error:</strong> The comment could not be saved. Please try again later.' ), 500 );
                                                                                                          Severity: Major
                                                                                                          Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                            Avoid too many return statements within this method.
                                                                                                            Open

                                                                                                                        return new WP_Error( 'comment_on_draft', __( 'Sorry, comments are not allowed for this item.' ), 403 );
                                                                                                            Severity: Major
                                                                                                            Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                              Avoid too many return statements within this method.
                                                                                                              Open

                                                                                                                      return $check_max_lengths;
                                                                                                              Severity: Major
                                                                                                              Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                                Avoid too many return statements within this method.
                                                                                                                Open

                                                                                                                        return new WP_Error( 'comment_on_password_protected' );
                                                                                                                Severity: Major
                                                                                                                Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this method.
                                                                                                                  Open

                                                                                                                              return new WP_Error( 'require_name_email', __( '<strong>Error:</strong> Please fill the required fields.' ), 200 );
                                                                                                                  Severity: Major
                                                                                                                  Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this method.
                                                                                                                    Open

                                                                                                                            return $comment_id;
                                                                                                                    Severity: Major
                                                                                                                    Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this method.
                                                                                                                      Open

                                                                                                                                  return new WP_Error( 'comment_on_draft' );
                                                                                                                      Severity: Major
                                                                                                                      Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

                                                                                                                                    return new WP_Error( 'not_logged_in', __( 'Sorry, you must be logged in to comment.' ), 403 );
                                                                                                                        Severity: Major
                                                                                                                        Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this method.
                                                                                                                          Open

                                                                                                                                      return new WP_Error( 'require_valid_email', __( '<strong>Error:</strong> Please enter a valid email address.' ), 200 );
                                                                                                                          Severity: Major
                                                                                                                          Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this method.
                                                                                                                            Open

                                                                                                                                    return new WP_Error( 'require_valid_comment', __( '<strong>Error:</strong> Please type your comment text.' ), 200 );
                                                                                                                            Severity: Major
                                                                                                                            Found in wp-includes/comment.php - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this method.
                                                                                                                              Open

                                                                                                                                  return get_comment( $comment_id );
                                                                                                                              Severity: Major
                                                                                                                              Found in wp-includes/comment.php - About 30 mins to fix

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

                                                                                                                                function _wp_batch_update_comment_type() {
                                                                                                                                    global $wpdb;
                                                                                                                                
                                                                                                                                    $lock_name = 'update_comment_type.lock';
                                                                                                                                
                                                                                                                                
                                                                                                                                Severity: Minor
                                                                                                                                Found in wp-includes/comment.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 _close_comments_for_old_post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                Open

                                                                                                                                function _close_comments_for_old_post( $open, $post_id ) {
                                                                                                                                    if ( ! $open ) {
                                                                                                                                        return $open;
                                                                                                                                    }
                                                                                                                                
                                                                                                                                
                                                                                                                                Severity: Minor
                                                                                                                                Found in wp-includes/comment.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 get_default_comment_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                Open

                                                                                                                                function get_default_comment_status( $post_type = 'post', $comment_type = 'comment' ) {
                                                                                                                                    switch ( $comment_type ) {
                                                                                                                                        case 'pingback':
                                                                                                                                        case 'trackback':
                                                                                                                                            $supports = 'trackbacks';
                                                                                                                                Severity: Minor
                                                                                                                                Found in wp-includes/comment.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 separate_comments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                Open

                                                                                                                                function separate_comments( &$comments ) {
                                                                                                                                    $comments_by_type = array(
                                                                                                                                        'comment'   => array(),
                                                                                                                                        'trackback' => array(),
                                                                                                                                        'pingback'  => array(),
                                                                                                                                Severity: Minor
                                                                                                                                Found in wp-includes/comment.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 get_lastcommentmodified has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                Open

                                                                                                                                function get_lastcommentmodified( $timezone = 'server' ) {
                                                                                                                                    global $wpdb;
                                                                                                                                
                                                                                                                                    $timezone = strtolower( $timezone );
                                                                                                                                    $key      = "lastcommentmodified:$timezone";
                                                                                                                                Severity: Minor
                                                                                                                                Found in wp-includes/comment.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

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

                                                                                                                                function wp_untrash_comment( $comment_id ) {
                                                                                                                                    $comment = get_comment( $comment_id );
                                                                                                                                    if ( ! $comment ) {
                                                                                                                                        return false;
                                                                                                                                    }
                                                                                                                                Severity: Major
                                                                                                                                Found in wp-includes/comment.php and 1 other location - About 4 hrs to fix
                                                                                                                                wp-includes/comment.php on lines 1677..1718

                                                                                                                                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 169.

                                                                                                                                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 wp_unspam_comment( $comment_id ) {
                                                                                                                                    $comment = get_comment( $comment_id );
                                                                                                                                    if ( ! $comment ) {
                                                                                                                                        return false;
                                                                                                                                    }
                                                                                                                                Severity: Major
                                                                                                                                Found in wp-includes/comment.php and 1 other location - About 4 hrs to fix
                                                                                                                                wp-includes/comment.php on lines 1578..1619

                                                                                                                                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 169.

                                                                                                                                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

                                                                                                                                    if ( wp_set_comment_status( $comment, 'spam' ) ) {
                                                                                                                                        delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
                                                                                                                                        delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
                                                                                                                                        add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved );
                                                                                                                                        add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() );
                                                                                                                                Severity: Major
                                                                                                                                Found in wp-includes/comment.php and 1 other location - About 1 hr to fix
                                                                                                                                wp-includes/comment.php on lines 1547..1565

                                                                                                                                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 111.

                                                                                                                                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

                                                                                                                                    if ( wp_set_comment_status( $comment, 'trash' ) ) {
                                                                                                                                        delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
                                                                                                                                        delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
                                                                                                                                        add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved );
                                                                                                                                        add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() );
                                                                                                                                Severity: Major
                                                                                                                                Found in wp-includes/comment.php and 1 other location - About 1 hr to fix
                                                                                                                                wp-includes/comment.php on lines 1646..1664

                                                                                                                                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 111.

                                                                                                                                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

                                                                                                                                    $comment_prop_to_export = array(
                                                                                                                                        'comment_author'       => __( 'Comment Author' ),
                                                                                                                                        'comment_author_email' => __( 'Comment Author Email' ),
                                                                                                                                        'comment_author_url'   => __( 'Comment Author URL' ),
                                                                                                                                        'comment_author_IP'    => __( 'Comment Author IP' ),
                                                                                                                                Severity: Major
                                                                                                                                Found in wp-includes/comment.php and 1 other location - About 1 hr to fix
                                                                                                                                wp-admin/options-discussion.php on lines 316..325

                                                                                                                                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 104.

                                                                                                                                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

                                                                                                                                    if ( isset( $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ) ) {
                                                                                                                                        /**
                                                                                                                                         * Filters the comment author's email cookie before it is set.
                                                                                                                                         *
                                                                                                                                         * When this filter hook is evaluated in wp_filter_comment(),
                                                                                                                                Severity: Minor
                                                                                                                                Found in wp-includes/comment.php and 1 other location - About 35 mins to fix
                                                                                                                                wp-includes/comment.php on lines 582..598

                                                                                                                                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 92.

                                                                                                                                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

                                                                                                                                    if ( isset( $_COOKIE[ 'comment_author_' . COOKIEHASH ] ) ) {
                                                                                                                                        /**
                                                                                                                                         * Filters the comment author's name cookie before it is set.
                                                                                                                                         *
                                                                                                                                         * When this filter hook is evaluated in wp_filter_comment(),
                                                                                                                                Severity: Minor
                                                                                                                                Found in wp-includes/comment.php and 1 other location - About 35 mins to fix
                                                                                                                                wp-includes/comment.php on lines 600..616

                                                                                                                                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 92.

                                                                                                                                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