seb86/Auto-Load-Next-Post

View on GitHub
includes/auto-load-next-post-template-functions.php

Summary

Maintainability
C
1 day
Test Coverage

Function alnp_scan_directories has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    function alnp_scan_directories( $post_type = 'post', $post_format = '' ) {
        // Possible locations where the content files are found.
        $locations = alnp_get_locations();

        // Templates to look for based on the post that is loaded.
Severity: Minor
Found in includes/auto-load-next-post-template-functions.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

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

    function alnp_template_redirect() {
        global $wp_query;

        // If this is not a request for alnp or a singular object then bail.
        if ( ! isset( $wp_query->query_vars['alnp'] ) || ! is_singular() ) {
Severity: Minor
Found in includes/auto-load-next-post-template-functions.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 alnp_find_template has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    function alnp_find_template( $location = '', $post_type, $post_format ) {
        // Templates to look for based on the post that is loaded.
        $templates = alnp_get_templates( $post_type, $post_format );

        $found = false;
Severity: Minor
Found in includes/auto-load-next-post-template-functions.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 alnp_load_content has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    function alnp_load_content( $post_type, $post_format ) {
        // Returns template location for supported themes.
        $template_location = alnp_template_location();

        $content_found = false;
Severity: Minor
Found in includes/auto-load-next-post-template-functions.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 alnp_load_content has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function alnp_load_content( $post_type, $post_format ) {
        // Returns template location for supported themes.
        $template_location = alnp_template_location();

        $content_found = false;
Severity: Minor
Found in includes/auto-load-next-post-template-functions.php - About 1 hr to fix

    There are no issues that match your filters.

    Category
    Status