CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/edit-comments.php

Summary

Maintainability
C
1 day
Test Coverage

File edit-comments.php has 382 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Edit Comments Administration Panel.
 *
 * @package WordPress
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/edit-comments.php - About 5 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if ( (isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp']) ) {
            $comment_status = $wpdb->escape($_REQUEST['comment_status']);
            $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
            $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" );
            $doaction = 'delete';
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/edit-comments.php - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

          if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 ) {
              echo '<div id="moderated" class="updated fade"><p>';
      
              if ( $approved > 0 ) {
                  printf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/edit-comments.php - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

        if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) ) {
            $approved = isset($_GET['approved']) ? (int) $_GET['approved'] : 0;
            $deleted = isset($_GET['deleted']) ? (int) $_GET['deleted'] : 0;
            $trashed = isset($_GET['trashed']) ? (int) $_GET['trashed'] : 0;
            $untrashed = isset($_GET['untrashed']) ? (int) $_GET['untrashed'] : 0;
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-admin/edit-comments.php - About 40 mins to fix

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

                  if ( $spammed > 0 ) {
                      printf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed );
                      $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
                      echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
                  }
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-admin/edit-comments.php and 1 other location - About 1 hr to fix
          Web.Admin/2014/wordpress/wp-admin/edit-comments.php on lines 163..167

          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 ( $trashed > 0 ) {
                      printf( _n( '%s comment moved to the trash.', '%s comments moved to the trash.', $trashed ), $trashed );
                      $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
                      echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
                  }
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-admin/edit-comments.php and 1 other location - About 1 hr to fix
          Web.Admin/2014/wordpress/wp-admin/edit-comments.php on lines 154..158

          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

          There are no issues that match your filters.

          Category
          Status