CaffGeek/MBACNationals

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

Summary

Maintainability
F
2 wks
Test Coverage

Function process_posts has a Cognitive Complexity of 687 (exceeds 5 allowed). Consider refactoring.
Open

    function process_posts() {
        global $wpdb;

        $handle = $this->fopen($this->file, 'r');
        if ( $handle == null )
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/import/mt.php - About 2 wks 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 mt.php has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Movable Type and TypePad Importer
 *
 * @package WordPress
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/import/mt.php - About 6 hrs to fix

    Method process_posts has 140 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function process_posts() {
            global $wpdb;
    
            $handle = $this->fopen($this->file, 'r');
            if ( $handle == null )
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/import/mt.php - About 5 hrs to fix

      Function save_post has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          function save_post(&$post, &$comments, &$pings) {
              // Reset the counter
              set_time_limit(30);
              $post = get_object_vars($post);
              $post = add_magic_quotes($post);
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/import/mt.php - About 2 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 save_post has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function save_post(&$post, &$comments, &$pings) {
              // Reset the counter
              set_time_limit(30);
              $post = get_object_vars($post);
              $post = add_magic_quotes($post);
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/import/mt.php - About 2 hrs to fix

        Function get_mt_authors has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            function get_mt_authors() {
                $temp = array();
                $authors = array();
        
                $handle = $this->fopen($this->file, 'r');
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/import/mt.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 checkauthor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            function checkauthor($author) {
                //mtnames is an array with the names in the mt import file
                $pass = wp_generate_password();
                if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
                    ++ $this->j;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/import/mt.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 get_authors_from_post has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            function get_authors_from_post() {
                $formnames = array ();
                $selectnames = array ();
        
                foreach ($_POST['user'] as $key => $line) {
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/import/mt.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 dispatch has a Cognitive Complexity of 7 (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/mt.php - About 35 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