CaffGeek/MBACNationals

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

Summary

Maintainability
F
2 wks
Test Coverage

File media.php has 1498 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WordPress Administration Media API.
 *
 * @package WordPress
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 3 days to fix

    Function get_media_item has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
    Open

    function get_media_item( $attachment_id, $args = null ) {
        global $redir_tab;
    
        if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
            $thumb_url = $thumb_url[0];
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 day 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 media_upload_form_handler has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

    function media_upload_form_handler() {
        check_admin_referer('media-form');
    
        $errors = null;
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 day 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_media_item has 159 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function get_media_item( $attachment_id, $args = null ) {
        global $redir_tab;
    
        if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
            $thumb_url = $thumb_url[0];
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 6 hrs to fix

      Function media_upload_library_form has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

      function media_upload_library_form($errors) {
          global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
      
          media_upload_header();
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 4 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 media_upload_library_form has 122 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function media_upload_library_form($errors) {
          global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
      
          media_upload_header();
      
      
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 4 hrs to fix

        Method media_upload_gallery_form has 120 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function media_upload_gallery_form($errors) {
            global $redir_tab, $type;
        
            $redir_tab = 'gallery';
            media_upload_header();
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 4 hrs to fix

          Method media_upload_form has 97 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function media_upload_form( $errors = null ) {
              global $type, $tab;
          
              $flash_action_url = admin_url('async-upload.php');
          
          
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 3 hrs to fix

            Method media_upload_type_url_form has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function media_upload_type_url_form($type = 'file', $errors = null, $id = null) {
                media_upload_header();
            
                $post_id = intval($_REQUEST['post_id']);
            
            
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 3 hrs to fix

              Method type_url_form_image has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function type_url_form_image() {
              
                  if ( !apply_filters( 'disable_captions', '' ) ) {
                      $caption = '
                      <tr>
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 2 hrs to fix

                Function media_upload_audio has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                function media_upload_audio() {
                    $errors = array();
                    $id = 0;
                
                    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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 media_upload_video has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                function media_upload_video() {
                    $errors = array();
                    $id = 0;
                
                    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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 media_upload_image has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                function media_upload_image() {
                    $errors = array();
                    $id = 0;
                
                    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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 media_upload_file has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                function media_upload_file() {
                    $errors = array();
                    $id = 0;
                
                    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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 media_upload_form_handler has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function media_upload_form_handler() {
                    check_admin_referer('media-form');
                
                    $errors = null;
                
                
                Severity: Major
                Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 2 hrs to fix

                  Method get_attachment_fields_to_edit has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function get_attachment_fields_to_edit($post, $errors = null) {
                      if ( is_int($post) )
                          $post =& get_post($post);
                      if ( is_array($post) )
                          $post = (object) $post;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 2 hrs to fix

                    Function get_media_items has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function get_media_items( $post_id, $errors ) {
                        if ( $post_id ) {
                            $post = get_post($post_id);
                            if ( $post && $post->post_type == 'attachment' )
                                $attachments = array($post->ID => $post);
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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_iframe has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function wp_iframe($content_func /* ... */) {
                    ?>
                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                    <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
                    <head>
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

                      Function image_size_input_fields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function image_size_input_fields( $post, $check = '' ) {
                      
                              // get a list of the actual pixel dimensions of each possible intermediate version of this image
                              $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size'));
                      
                      
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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 media_upload_image has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function media_upload_image() {
                          $errors = array();
                          $id = 0;
                      
                          if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

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

                        function media_upload_type_form($type = 'file', $errors = null, $id = null) {
                            media_upload_header();
                        
                            $post_id = intval($_REQUEST['post_id']);
                        
                        
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

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

                          function media_upload_audio() {
                              $errors = array();
                              $id = 0;
                          
                              if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

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

                            function media_upload_video() {
                                $errors = array();
                                $id = 0;
                            
                                if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

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

                              function media_upload_file() {
                                  $errors = array();
                                  $id = 0;
                              
                                  if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

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

                                function the_media_upload_tabs() {
                                    global $redir_tab;
                                    $tabs = media_upload_tabs();
                                
                                    if ( !empty($tabs) ) {
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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 media_handle_upload has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function media_handle_upload($file_id, $post_id, $post_data = array()) {
                                    $overrides = array('test_form'=>false);
                                
                                    $time = current_time('mysql');
                                    if ( $post = get_post($post_id) ) {
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

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

                                  function get_attachment_fields_to_edit($post, $errors = null) {
                                      if ( is_int($post) )
                                          $post =& get_post($post);
                                      if ( is_array($post) )
                                          $post = (object) $post;
                                  Severity: Minor
                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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 image_size_input_fields has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function image_size_input_fields( $post, $check = '' ) {
                                  
                                          // get a list of the actual pixel dimensions of each possible intermediate version of this image
                                          $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size'));
                                  
                                  
                                  Severity: Minor
                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

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

                                    function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
                                        $overrides = array('test_form'=>false);
                                    
                                        $file = wp_handle_sideload($file_array, $overrides);
                                        if ( isset($file['error']) )
                                    Severity: Minor
                                    Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

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

                                      function media_handle_upload($file_id, $post_id, $post_data = array()) {
                                          $overrides = array('test_form'=>false);
                                      
                                          $time = current_time('mysql');
                                          if ( $post = get_post($post_id) ) {
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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_image_send_to_editor has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') {
                                      Severity: Major
                                      Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

                                        Method image_add_caption has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
                                        Severity: Major
                                        Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 1 hr to fix

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

                                          function media_upload_form( $errors = null ) {
                                              global $type, $tab;
                                          
                                              $flash_action_url = admin_url('async-upload.php');
                                          
                                          
                                          Severity: Minor
                                          Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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 media_handle_sideload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                          function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
                                              $overrides = array('test_form'=>false);
                                          
                                              $file = wp_handle_sideload($file_array, $overrides);
                                              if ( isset($file['error']) )
                                          Severity: Minor
                                          Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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 wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
                                          Severity: Major
                                          Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
                                            Severity: Major
                                            Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                  return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
                                              Severity: Major
                                              Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                    return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
                                                Severity: Major
                                                Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php - About 30 mins to fix

                                                  Function media_sideload_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  function media_sideload_image($file, $post_id, $desc = null) {
                                                      if (!empty($file) ) {
                                                          // Download file to temp location
                                                          $tmp = download_url($file);
                                                  
                                                  
                                                  Severity: Minor
                                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/media.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

                                                  function media_upload_audio() {
                                                      $errors = array();
                                                      $id = 0;
                                                  
                                                      if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                                                  Severity: Major
                                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php and 1 other location - About 2 days to fix
                                                  Web.Admin/2014/wordpress/wp-admin/includes/media.php on lines 632..681

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

                                                  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

                                                  function media_upload_video() {
                                                      $errors = array();
                                                      $id = 0;
                                                  
                                                      if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                                                  Severity: Major
                                                  Found in Web.Admin/2014/wordpress/wp-admin/includes/media.php and 1 other location - About 2 days to fix
                                                  Web.Admin/2014/wordpress/wp-admin/includes/media.php on lines 574..623

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

                                                  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