CaffGeek/MBACNationals

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

Summary

Maintainability
F
4 days
Test Coverage

Function post_submit_meta_box has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

function post_submit_meta_box($post) {
    global $action;

    $post_type = $post->post_type;
    $can_publish = current_user_can("publish_${post_type}s");
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.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

File meta-boxes.php has 566 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

// -- Post related Meta Boxes

/**
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.php - About 1 day to fix

    Method post_submit_meta_box has 188 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function post_submit_meta_box($post) {
        global $action;
    
        $post_type = $post->post_type;
        $can_publish = current_user_can("publish_${post_type}s");
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.php - About 7 hrs to fix

      Method link_xfn_meta_box has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function link_xfn_meta_box($link) {
      ?>
      <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
          <tr>
              <th style="width: 20%;" scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.php - About 2 hrs to fix

        Method link_submit_meta_box has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function link_submit_meta_box($link) {
        ?>
        <div class="submitbox" id="submitlink">
        
        <div id="minor-publishing">
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.php - About 1 hr to fix

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

          function xfn_check($class, $value = '', $deprecated = '') {
              global $link;
          
              $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
              $rels = preg_split('/\s+/', $link_rel);
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.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 link_categories_meta_box has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function link_categories_meta_box($link) { ?>
          <ul id="category-tabs">
              <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
              <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
          </ul>
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.php - About 1 hr to fix

            Method link_advanced_meta_box has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function link_advanced_meta_box($link) {
            ?>
            <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
                <tr class="form-field">
                    <th valign="top"  scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.php - About 1 hr to fix

              Method post_categories_meta_box has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function post_categories_meta_box($post) {
              ?>
              <ul id="category-tabs">
                  <li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
                  <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.php - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
                Severity: Major
                Found in Web.Admin/2014/wordpress/wp-admin/includes/meta-boxes.php - About 40 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status