CaffGeek/MBACNationals

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

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php
/**
 * Manages WordPress comments
 *
 * @package WordPress
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 2 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 ( 1 == get_option('comment_moderation') )
            return false; // If moderation is set to manual
    Severity: Minor
    Found in Web.Admin/2014/wordpress/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 pingback has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    function pingback($content, $post_ID) {
        global $wp_version;
        include_once(ABSPATH . WPINC . '/class-IXR.php');
    
        // original code by Mort (http://mort.mine.nu:8080)
    Severity: Minor
    Found in Web.Admin/2014/wordpress/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 get_comment has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function &get_comment(&$comment, $output = OBJECT) {
        global $wpdb;
        $null = null;
    
        if ( empty($comment) ) {
    Severity: Minor
    Found in Web.Admin/2014/wordpress/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 check_comment has 44 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 ( 1 == get_option('comment_moderation') )
            return false; // If moderation is set to manual
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

      Method get_comments has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function get_comments( $args = '' ) {
          global $wpdb;
      
          $defaults = array('status' => '', 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'number' => '', 'offset' => '', 'post_id' => 0);
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

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

        function wp_allow_comment($commentdata) {
            global $wpdb;
            extract($commentdata, EXTR_SKIP);
        
            // Simple duplicate check
        Severity: Minor
        Found in Web.Admin/2014/wordpress/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 get_comments has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function get_comments( $args = '' ) {
            global $wpdb;
        
            $defaults = array('status' => '', 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'number' => '', 'offset' => '', 'post_id' => 0);
        
        
        Severity: Minor
        Found in Web.Admin/2014/wordpress/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 get_comment_count has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function get_comment_count( $post_id = 0 ) {
            global $wpdb;
        
            $post_id = (int) $post_id;
        
        
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

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

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

            Function wp_count_comments has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function wp_count_comments( $post_id = 0 ) {
                global $wpdb;
            
                $post_id = (int) $post_id;
            
            
            Severity: Minor
            Found in Web.Admin/2014/wordpress/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 get_page_of_comment has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function get_page_of_comment( $comment_ID, $args = array() ) {
                global $wpdb;
            
                if ( !$comment = get_comment( $comment_ID ) )
                    return;
            Severity: Minor
            Found in Web.Admin/2014/wordpress/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 discover_pingback_server_uri has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function discover_pingback_server_uri($url, $deprecated = 2048) {
            
                $pingback_str_dquote = 'rel="pingback"';
                $pingback_str_squote = 'rel=\'pingback\'';
            
            
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

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

              function pingback($content, $post_ID) {
                  global $wp_version;
                  include_once(ABSPATH . WPINC . '/class-IXR.php');
              
                  // original code by Mort (http://mort.mine.nu:8080)
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

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

                function &get_comment(&$comment, $output = OBJECT) {
                    global $wpdb;
                    $null = null;
                
                    if ( empty($comment) ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

                  Function get_comment_pages_count has a Cognitive Complexity of 11 (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 Web.Admin/2014/wordpress/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 discover_pingback_server_uri has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function discover_pingback_server_uri($url, $deprecated = 2048) {
                  
                      $pingback_str_dquote = 'rel="pingback"';
                      $pingback_str_squote = 'rel=\'pingback\'';
                  
                  
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/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 get_page_of_comment has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function get_page_of_comment( $comment_ID, $args = array() ) {
                      global $wpdb;
                  
                      if ( !$comment = get_comment( $comment_ID ) )
                          return;
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

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

                    function wp_allow_comment($commentdata) {
                        global $wpdb;
                        extract($commentdata, EXTR_SKIP);
                    
                        // Simple duplicate check
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

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

                      function wp_count_comments( $post_id = 0 ) {
                          global $wpdb;
                      
                          $post_id = (int) $post_id;
                      
                      
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

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

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

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

                          function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
                              global $wpdb;
                          
                              $status = '0';
                              switch ( $comment_status ) {
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/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 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function do_trackbacks($post_id) {
                              global $wpdb;
                          
                              $post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) );
                              $to_ping = get_to_ping($post_id);
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/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 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function do_trackbacks($post_id) {
                              global $wpdb;
                          
                              $post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) );
                              $to_ping = get_to_ping($post_id);
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

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

                            function wp_insert_comment($commentdata) {
                                global $wpdb;
                                extract(stripslashes_deep($commentdata), EXTR_SKIP);
                            
                                if ( ! isset($comment_author_IP) )
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 1 hr to fix

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

                              function wp_insert_comment($commentdata) {
                                  global $wpdb;
                                  extract(stripslashes_deep($commentdata), EXTR_SKIP);
                              
                                  if ( ! isset($comment_author_IP) )
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/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_new_comment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function wp_new_comment( $commentdata ) {
                                  $commentdata = apply_filters('preprocess_comment', $commentdata);
                              
                                  $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
                                  if ( isset($commentdata['user_ID']) )
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/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 Web.Admin/2014/wordpress/wp-includes/comment.php - About 50 mins to fix

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

                                function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) {
                                    do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent);
                                
                                    $mod_keys = trim( get_option('blacklist_keys') );
                                    if ( '' == $mod_keys )
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/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_blacklist_check has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

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

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

                                  function wp_update_comment($commentarr) {
                                      global $wpdb;
                                  
                                      // First, get all of the original fields
                                      $comment = get_comment($commentarr['comment_ID'], ARRAY_A);
                                  Severity: Minor
                                  Found in Web.Admin/2014/wordpress/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

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if (
                                                 preg_match($pattern, $author)
                                              || preg_match($pattern, $email)
                                              || preg_match($pattern, $url)
                                              || preg_match($pattern, $comment)
                                  Severity: Major
                                  Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 40 mins to fix

                                    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 Web.Admin/2014/wordpress/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_delete_comment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function wp_delete_comment($comment_id) {
                                        global $wpdb;
                                        if (!$comment = get_comment($comment_id))
                                            return false;
                                    
                                    
                                    Severity: Minor
                                    Found in Web.Admin/2014/wordpress/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 get_comment_count has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function get_comment_count( $post_id = 0 ) {
                                        global $wpdb;
                                    
                                        $post_id = (int) $post_id;
                                    
                                    
                                    Severity: Minor
                                    Found in Web.Admin/2014/wordpress/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 check_comment_flood_db has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function check_comment_flood_db( $ip, $email, $date ) {
                                        global $wpdb;
                                        if ( current_user_can( 'manage_options' ) )
                                            return; // don't throttle admins
                                        $hour_ago = gmdate( 'Y-m-d H:i:s', time() - 3600 );
                                    Severity: Minor
                                    Found in Web.Admin/2014/wordpress/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 Web.Admin/2014/wordpress/wp-includes/comment.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  if ( preg_match($pattern, $comment) ) return false;
                                      Severity: Major
                                      Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    if ( preg_match($pattern, $user_agent) ) return false;
                                        Severity: Major
                                        Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      if ( preg_match($pattern, $user_ip) ) return false;
                                          Severity: Major
                                          Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

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

                                              Avoid too many return statements within this method.
                                              Open

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

                                                Avoid too many return statements within this method.
                                                Open

                                                            if ( preg_match($pattern, $url) ) return false;
                                                Severity: Major
                                                Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

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

                                                    Avoid too many return statements within this method.
                                                    Open

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

                                                      Avoid too many return statements within this method.
                                                      Open

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

                                                        Avoid too many return statements within this method.
                                                        Open

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

                                                          Avoid too many return statements within this method.
                                                          Open

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

                                                            Avoid too many return statements within this method.
                                                            Open

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

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                  return ceil( ( $oldercoms + 1 ) / $args['per_page'] );
                                                              Severity: Major
                                                              Found in Web.Admin/2014/wordpress/wp-includes/comment.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

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

                                                                  Avoid too many return statements within this method.
                                                                  Open

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

                                                                    Avoid too many return statements within this method.
                                                                    Open

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

                                                                      Avoid too many return statements within this method.
                                                                      Open

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

                                                                        Avoid too many return statements within this method.
                                                                        Open

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

                                                                          Avoid too many return statements within this method.
                                                                          Open

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

                                                                            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(), 'pings' => array());
                                                                                $count = count($comments);
                                                                                for ( $i = 0; $i < $count; $i++ ) {
                                                                                    $type = $comments[$i]->comment_type;
                                                                            Severity: Minor
                                                                            Found in Web.Admin/2014/wordpress/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

                                                                                if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
                                                                                    $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
                                                                                    $comment_author_email = stripslashes($comment_author_email);
                                                                                    $comment_author_email = esc_attr($comment_author_email);
                                                                                    $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
                                                                            Severity: Minor
                                                                            Found in Web.Admin/2014/wordpress/wp-includes/comment.php and 1 other location - About 35 mins to fix
                                                                            Web.Admin/2014/wordpress/wp-includes/comment.php on lines 456..461

                                                                            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]) ) {
                                                                                    $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]);
                                                                                    $comment_author = stripslashes($comment_author);
                                                                                    $comment_author = esc_attr($comment_author);
                                                                                    $_COOKIE['comment_author_'.COOKIEHASH] = $comment_author;
                                                                            Severity: Minor
                                                                            Found in Web.Admin/2014/wordpress/wp-includes/comment.php and 1 other location - About 35 mins to fix
                                                                            Web.Admin/2014/wordpress/wp-includes/comment.php on lines 463..468

                                                                            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