CaffGeek/MBACNationals

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

Summary

Maintainability
F
4 days
Test Coverage

Function install_theme_information has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

function install_theme_information() {
    //TODO: This function needs a LOT of UI work :)
    global $tab, $themes_allowedtags;

    $api = themes_api('theme_information', array('slug' => stripslashes( $_REQUEST['theme'] ) ));
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php - About 5 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

File theme-install.php has 378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WordPress Theme Install Administration API
 *
 * @package WordPress
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php - About 5 hrs to fix

    Function display_themes has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    function display_themes($themes, $page = 1, $totalpages = 1) {
        global $themes_allowedtags;
    
        $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
        $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.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 install_theme_information has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function install_theme_information() {
        //TODO: This function needs a LOT of UI work :)
        global $tab, $themes_allowedtags;
    
        $api = themes_api('theme_information', array('slug' => stripslashes( $_REQUEST['theme'] ) ));
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php - About 3 hrs to fix

      Method display_themes has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function display_themes($themes, $page = 1, $totalpages = 1) {
          global $themes_allowedtags;
      
          $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
          $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php - About 2 hrs to fix

        Method display_theme has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function display_theme($theme, $actions = null, $show_details = true) {
            global $themes_allowedtags;
        
            if ( empty($theme) )
                return;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php - About 1 hr to fix

          Method install_themes_dashboard has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function install_themes_dashboard() {
              install_theme_search_form();
          ?>
          <h4><?php _e('Feature Filter') ?></h4>
          <form method="post" action="<?php echo admin_url( 'theme-install.php?tab=search' ); ?>">
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php - About 1 hr to fix

            Method install_theme_search has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function install_theme_search($page) {
                global $theme_field_defaults;
            
                $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
                $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php - About 1 hr to fix

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

              function display_theme($theme, $actions = null, $show_details = true) {
                  global $themes_allowedtags;
              
                  if ( empty($theme) )
                      return;
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.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

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

              function themes_api($action, $args = null) {
              
                  if ( is_array($args) )
                      $args = (object)$args;
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.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 install_themes_dashboard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function install_themes_dashboard() {
                  install_theme_search_form();
              ?>
              <h4><?php _e('Feature Filter') ?></h4>
              <form method="post" action="<?php echo admin_url( 'theme-install.php?tab=search' ); ?>">
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php - About 45 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 install_theme_search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function install_theme_search($page) {
                  global $theme_field_defaults;
              
                  $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
                  $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.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

              $themes_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()),
                  'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
                  'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
                  'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),
                  'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php and 1 other location - About 4 hrs to fix
              Web.Admin/2014/wordpress/wp-admin/includes/plugin-install.php on lines 406..411

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

              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 ( ! $res ) {
                      $request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
                      if ( is_wp_error($request) ) {
                          $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occured during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() );
                      } else {
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php and 1 other location - About 3 hrs to fix
              Web.Admin/2014/wordpress/wp-admin/includes/plugin-install.php on lines 40..51

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

              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 install_themes_featured($page = 1) {
                  global $theme_field_defaults;
                  $args = array('browse' => 'featured', 'page' => $page, 'fields' => $theme_field_defaults);
                  $api = themes_api('query_themes', $args);
                  if ( is_wp_error($api) )
              Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php on lines 251..258

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

              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 install_themes_new($page = 1) {
                  global $theme_field_defaults;
                  $args = array('browse' => 'new', 'page' => $page, 'fields' => $theme_field_defaults);
                  $api = themes_api('query_themes', $args);
                  if ( is_wp_error($api) )
              Web.Admin/2014/wordpress/wp-admin/includes/theme-install.php on lines 234..241

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

              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