felixarntz/wp-shortcode-cache

View on GitHub

Showing 45 of 45 total issues

Detected usage of a non-sanitized input variable: $_GET
Open

                            $attr[ $identifier ] = $_GET[ $params['name'] ];

Expected 1 space after comma in function call; 4 found
Open

    add_filter( 'wp_shortcode_cache_use_cache_video',    '__return_false' );

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Open

                __( 'Please note: WP Shortcode Cache requires WordPress 4.7-beta or higher. <a href="%s">Deactivate plugin</a>.', 'wp-shortcode-cache' ),
Severity: Minor
Found in wp-shortcode-cache.php by phpcodesniffer

All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'wp_nonce_url'.
Open

                wp_nonce_url(
Severity: Minor
Found in wp-shortcode-cache.php by phpcodesniffer

Missing wp_unslash() before sanitization.
Open

                            $attr[ $identifier ] = $_GET[ $params['name'] ];

Expected 1 space after comma in function call; 5 found
Open

    add_filter( 'do_shortcode_tag',     array( $shortcode_cache, 'maybe_cache_output' ),         1,   4 );
Severity: Minor
Found in wp-shortcode-cache.php by phpcodesniffer

Closing PHP tag must be on a line by itself
Open

            ); ?>
Severity: Minor
Found in wp-shortcode-cache.php by phpcodesniffer

Expected 1 space after comma in function call; 2 found
Open

    add_filter( 'wp_shortcode_cache_use_cache_gallery',  '__return_false' );

Expected 1 space after comma in function call; 8 found
Open

    add_filter( 'wp_shortcode_cache_use_cache_edd_receipt',        '__return_false' );

Detected usage of a non-sanitized input variable: $_POST
Open

                            $attr[ $identifier ] = $_POST[ $params['name'] ];

Expected 1 space after comma in function call; 6 found
Open

    add_filter( 'wp_shortcode_cache_use_cache_download_cart',      '__return_false' );

Empty line required before block comment
Open

/*
Severity: Minor
Found in wp-shortcode-cache.php by phpcodesniffer

Missing class import via use statement (line '153', column '14').
Open

        return new WP_Error( 'invalid_external_data_value_type', sprintf( __( '%s is not a valid type for external cache data registered for shortcode %2$s.', 'wp-shortcode-cache' ), esc_attr( $type ), esc_attr( $this->tag ) ) );

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '127', column '30').
Open

            $this->tags[ $tag ] = new WP_Shortcode_Cache_Tag( $tag );

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '90', column '16').
Open

        $error = new WP_Error();

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '59', column '30').
Open

            $this->tags[ $tag ] = new WP_Shortcode_Cache_Tag( $tag );

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '86', column '30').
Open

            $this->tags[ $tag ] = new WP_Shortcode_Cache_Tag( $tag );

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '107', column '15').
Open

            return new WP_Error( 'no_external_data', sprintf( __( 'No external cache data is registered for shortcode %s.', 'wp-shortcode-cache' ), esc_attr( $tag ) ) );

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '176', column '14').
Open

        return new WP_Error( 'invalid_external_data_value_identifier', sprintf( __( 'No external cache data value with identifier %1$s is registered for shortcode %2$s.', 'wp-shortcode-cache' ), esc_attr( $identifier ), esc_attr( $this->tag ) ) );

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Function retrieve_cache_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function retrieve_cache_data( $tag, $attr, $matches ) {
        if ( isset( $this->tags[ $tag ] ) ) {
            $attr = $this->tags[ $tag ]->fill_external_data( $attr );
        } else {
            /* By default, always include global $post and the current user. */
Severity: Minor
Found in wp-shortcode-cache/class-wp-shortcode-cache.php - About 25 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

Severity
Category
Status
Source
Language