CaffGeek/MBACNationals

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

Summary

Maintainability
B
4 hrs
Test Coverage

Function locate_template has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function locate_template($template_names, $load = false, $require_once = true ) {
    $located = '';
    foreach ( (array) $template_names as $template_name ) {
        if ( !$template_name )
            continue;
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/template.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 get_attachment_template has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function get_attachment_template() {
    global $posts;

    if ( ! empty( $posts ) && isset( $posts[0]->post_mime_type ) ) {
        $type = explode( '/', $posts[0]->post_mime_type );
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/template.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 get_page_template has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function get_page_template() {
    $id = get_queried_object_id();
    $template = get_page_template_slug();
    $pagename = get_query_var('pagename');

Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/template.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

There are no issues that match your filters.

Category
Status