CaffGeek/MBACNationals

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

Summary

Maintainability
B
4 hrs
Test Coverage

Function wp_insert_category has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function wp_insert_category($catarr, $wp_error = false) {
    $cat_defaults = array('cat_ID' => 0, 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
    $catarr = wp_parse_args($catarr, $cat_defaults);
    extract($catarr, EXTR_SKIP);

Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/taxonomy.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 wp_insert_category has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function wp_insert_category($catarr, $wp_error = false) {
    $cat_defaults = array('cat_ID' => 0, 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
    $catarr = wp_parse_args($catarr, $cat_defaults);
    extract($catarr, EXTR_SKIP);

Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/taxonomy.php - About 1 hr to fix

    Function wp_create_categories has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_create_categories($categories, $post_id = '') {
        $cat_ids = array ();
        foreach ($categories as $category) {
            if ($id = category_exists($category))
                $cat_ids[] = $id;
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/taxonomy.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

    Avoid too many return statements within this method.
    Open

        return $cat_ID['term_id'];
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/includes/taxonomy.php - About 30 mins to fix

      There are no issues that match your filters.

      Category
      Status