CaffGeek/MBACNationals

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

Summary

Maintainability
C
1 day
Test Coverage

File custom-header.php has 305 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * The custom header image script.
 *
 * @package WordPress
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/custom-header.php - About 3 hrs to fix

    Method js_1 has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function js_1() { ?>
    <script type="text/javascript">
        var buttons = ['#name', '#desc', '#pickcolor', '#defaultcolor'];
        var farbtastic;
    
    
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/custom-header.php - About 2 hrs to fix

      Method step_2 has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function step_2() {
              check_admin_referer('custom-header');
              $overrides = array('test_form' => false);
              $file = wp_handle_upload($_FILES['import'], $overrides);
      
      
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/custom-header.php - About 2 hrs to fix

        Method step_1 has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function step_1() {
                if ( $_GET['updated'] ) { ?>
        <div id="message" class="updated fade">
        <p><?php _e('Header updated.') ?></p>
        </div>
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/custom-header.php - About 1 hr to fix

          Method js_2 has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function js_2() { ?>
          <script type="text/javascript">
              function onEndCrop( coords ) {
                  jQuery( '#x1' ).val(coords.x);
                  jQuery( '#y1' ).val(coords.y);
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/custom-header.php - About 1 hr to fix

            Method step_3 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function step_3() {
                    check_admin_referer('custom-header');
                    if ( $_POST['oitar'] > 1 ) {
                        $_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
                        $_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/custom-header.php - About 1 hr to fix

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

                  function take_action() {
                      if ( isset( $_POST['textcolor'] ) ) {
                          check_admin_referer('custom-header');
                          if ( 'blank' == $_POST['textcolor'] ) {
                              set_theme_mod('header_textcolor', 'blank');
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/custom-header.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

              There are no issues that match your filters.

              Category
              Status