CaffGeek/MBACNationals

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

Summary

Maintainability
F
1 wk
Test Coverage

Method wp_print_media_templates has 843 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function wp_print_media_templates() {
    global $is_IE;
    $class = 'media-modal wp-core-ui';
    if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )
        $class .= ' ie7';
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/media-template.php - About 4 days to fix

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

    <?php
    /**
     * WordPress media templates.
     *
     * @package WordPress
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/media-template.php - About 2 days to fix

      Function wp_print_media_templates has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function wp_print_media_templates() {
          global $is_IE;
          $class = 'media-modal wp-core-ui';
          if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )
              $class .= ' ie7';
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/media-template.php - About 3 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_underscore_video_template has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function wp_underscore_video_template() {
          $video_types = wp_get_video_extensions();
      ?>
      <#  var w, h, settings = wp.media.view.settings,
              isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/media-template.php - About 2 hrs to fix

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

        function wp_underscore_video_template() {
            $video_types = wp_get_video_extensions();
        ?>
        <#  var w, h, settings = wp.media.view.settings,
                isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/media-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