CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/import/greymatter.php

Summary

Maintainability
F
3 days
Test Coverage

Function import has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring.
Open

    function import() {
        global $wpdb;

        $wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
        for ($i=0; $i<count($wpvarstoreset); $i += 1) {
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/import/greymatter.php - About 2 days 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 import has 182 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function import() {
        global $wpdb;

        $wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
        for ($i=0; $i<count($wpvarstoreset); $i += 1) {
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/import/greymatter.php - About 7 hrs to fix

    File greymatter.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * GreyMatter Importer
     *
     * @package WordPress
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/import/greymatter.php - About 2 hrs to fix

      Method greet has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function greet() {
              $this->header();
      ?>
      <p><?php _e('This is a basic GreyMatter to WordPress import script.') ?></p>
      <p><?php _e('What it does:') ?></p>
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/import/greymatter.php - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                            if (($commentinfo[11]=="PM") && ($commenthour!="12"))
                                $commenthour=$commenthour+12;
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-admin/import/greymatter.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if ($i<10000) {
                                  $entryfile .= "0";
                                  if ($i<1000) {
                                      $entryfile .= "0";
                                      if ($i<100) {
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-admin/import/greymatter.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if (!comment_exists($comment_author, $comment_date)) {
                                    $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_content', 'comment_approved');
                                    $commentdata = wp_filter_comment($commentdata);
                                    wp_insert_comment($commentdata);
                                    $numAddedComments++;
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/import/greymatter.php - About 45 mins to fix

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

                  function dispatch() {
                      if (empty ($_GET['step']))
                          $step = 0;
                      else
                          $step = (int) $_GET['step'];
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/import/greymatter.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