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.
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;
- Read upRead up
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);
- Read upRead up
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;
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' );
- Read upRead up
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;
- Read upRead up
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);
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;
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' );
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']) ) {
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);
- Read upRead up
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);
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 ) {
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']) ) {
- Read upRead up
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' => '');
- Read upRead up
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();
- Read upRead up
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"