CaffGeek/MBACNationals

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

Summary

Maintainability
F
4 days
Test Coverage

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

<?php
/**
 * Comment template functions
 *
 * These functions are meant to live inside of the WordPress loop.
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 1 day to fix

    Function wp_list_comments has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_list_comments($args = array(), $comments = null ) {
        global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop;
    
        $in_comment_loop = true;
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 5 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_class has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
        global $comment_alt, $comment_depth, $comment_thread_alt;
    
        $comment = get_comment($comment_id);
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/comment-template.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_list_comments has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wp_list_comments($args = array(), $comments = null ) {
        global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop;
    
        $in_comment_loop = true;
    
    
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 2 hrs to fix

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

      function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
          global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
      
          if ( false === $zero ) $zero = __( 'No Comments' );
          if ( false === $one ) $one = __( '1 Comment' );
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/comment-template.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 comments_template has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      function comments_template( $file = '/comments.php', $separate_comments = false ) {
          global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
      
          if ( !(is_single() || is_page() || $withcomments) || empty($post) )
              return;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method get_comment_class has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
          global $comment_alt, $comment_depth, $comment_thread_alt;
      
          $comment = get_comment($comment_id);
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 1 hr to fix

        Method comments_template has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function comments_template( $file = '/comments.php', $separate_comments = false ) {
            global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
        
            if ( !(is_single() || is_page() || $withcomments) || empty($post) )
                return;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 1 hr to fix

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

          function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
              global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
          
              if ( false === $zero ) $zero = __( 'No Comments' );
              if ( false === $one ) $one = __( '1 Comment' );
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 1 hr to fix

            Method start_el has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function start_el(&$output, $comment, $depth, $args) {
                    $depth++;
                    $GLOBALS['comment_depth'] = $depth;
            
                    if ( !empty($args['callback']) ) {
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 1 hr to fix

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

              function get_comment_link( $comment = null, $args = array() ) {
                  global $wp_rewrite, $in_comment_loop;
              
                  $comment = get_comment($comment);
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/comment-template.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_link has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function get_comment_link( $comment = null, $args = array() ) {
                  global $wp_rewrite, $in_comment_loop;
              
                  $comment = get_comment($comment);
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 1 hr to fix

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

                function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 35 mins to fix

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

                      function start_el(&$output, $comment, $depth, $args) {
                          $depth++;
                          $GLOBALS['comment_depth'] = $depth;
                  
                          if ( !empty($args['callback']) ) {
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/comment-template.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_reply_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function get_comment_reply_link($args = array(), $comment = null, $post = null) {
                      global $user_ID;
                  
                      $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'),
                          'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/comment-template.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 comment_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false) {
                      if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' );
                      if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' );
                      if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' );
                      $type = get_comment_type();
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/comment-template.php - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  There are no issues that match your filters.

                  Category
                  Status