CaffGeek/MBACNationals

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

Summary

Maintainability
D
2 days
Test Coverage

File upload.php has 386 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Media Library administration panel.
 *
 * @package WordPress
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/upload.php - About 5 hrs to fix

    Consider simplifying this complex logical expression.
    Open

    if ( isset($_GET['find_detached']) ) {
        check_admin_referer('bulk-media');
    
        if ( !current_user_can('edit_posts') )
            wp_die( __('You are not allowed to scan for lost attachments.') );
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/upload.php - About 40 mins to fix

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

              if ( current_user_can('delete_post', $post->ID) )
                  if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
                      $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
                  } else {
                      $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/upload.php and 1 other location - About 4 hrs to fix
      Web.Admin/2014/wordpress/wp-admin/includes/class-wp-media-list-table.php on lines 433..439

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

      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

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

                  if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
                      if ( $t_diff < 0 )
                          $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
                      else
                          $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/upload.php and 1 other location - About 2 hrs to fix
      Web.Admin/2014/wordpress/wp-admin/edit-attachment-rows.php on lines 155..162

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

      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

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

      if ( $page_links ) : ?>
      <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
          number_format_i18n( ( $_GET['paged'] - 1 ) * $wp_query->query_vars['posts_per_page'] + 1 ),
          number_format_i18n( min( $_GET['paged'] * $wp_query->query_vars['posts_per_page'], $wp_query->found_posts ) ),
          number_format_i18n( $wp_query->found_posts ),
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/upload.php and 1 other location - About 2 hrs to fix
      Web.Admin/2014/wordpress/wp-admin/edit.php on lines 314..321

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

      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

              case 'delete':
                  foreach( (array) $post_ids as $post_id_del ) {
                      if ( !current_user_can('delete_post', $post_id_del) )
                          wp_die( __('You are not allowed to delete this post.') );
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/upload.php and 1 other location - About 55 mins to fix
      Web.Admin/2014/wordpress/wp-admin/upload.php on lines 100..109

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

      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

              case 'untrash':
                  foreach( (array) $post_ids as $post_id ) {
                      if ( !current_user_can('delete_post', $post_id) )
                          wp_die( __('You are not allowed to move this post out of the trash.') );
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/upload.php and 1 other location - About 55 mins to fix
      Web.Admin/2014/wordpress/wp-admin/upload.php on lines 110..119

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

      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