CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/includes/class-wp-themes-list-table.php

Summary

Maintainability
C
1 day
Test Coverage

Function search_theme has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    function search_theme( $theme ) {
        // Search the features
        foreach ( $this->features as $word ) {
            if ( ! in_array( $word, $theme->get('Tags') ) )
                return false;

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 display_rows has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function display_rows() {
        $themes = $this->items;

        foreach ( $themes as $theme ):
            ?><div class="available-theme"><?php

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

        function display_rows() {
            $themes = $this->items;
    
            foreach ( $themes as $theme ):
                ?><div class="available-theme"><?php

    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 no_items has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        function no_items() {
            if ( $this->search_terms || $this->features ) {
                _e( 'No items found.' );
                return;
            }

    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 prepare_items has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        function prepare_items() {
            $themes = wp_get_themes( array( 'allowed' => true ) );
    
            if ( ! empty( $_REQUEST['s'] ) )
                $this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) );

    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