felixarntz/wp-shortcode-cache

View on GitHub

Showing 45 of 45 total issues

Function fill_external_data has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    public function fill_external_data( $attr ) {
        foreach ( $this->callbacks as $identifier => $params ) {
            if ( isset( $attr[ $identifier ] ) ) {
                continue;
            }
Severity: Minor
Found in wp-shortcode-cache/class-wp-shortcode-cache-tag.php - About 5 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_shortcode_cache_register_edd_support has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function wp_shortcode_cache_register_edd_support() {
    wp_shortcode_cache_register_external_data_values( 'purchase_link', array(
        'id'                 => array(
            'name' => 'post',
            'type' => 'global',
Severity: Major
Found in wp-shortcode-cache/default-support.php - About 4 hrs to fix

    Method fill_external_data has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function fill_external_data( $attr ) {
            foreach ( $this->callbacks as $identifier => $params ) {
                if ( isset( $attr[ $identifier ] ) ) {
                    continue;
                }
    Severity: Minor
    Found in wp-shortcode-cache/class-wp-shortcode-cache-tag.php - About 1 hr to fix

      Function register_external_data_values has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function register_external_data_values( $external_data ) {
              $error = new WP_Error();
      
              foreach ( $external_data as $identifier => $params ) {
                  if ( is_string( $params ) ) {
      Severity: Minor
      Found in wp-shortcode-cache/class-wp-shortcode-cache-tag.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 wp_shortcode_cache_register_external_data_value has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function wp_shortcode_cache_register_external_data_value( $tag, $data_identifier, $data_name, $data_type = 'global', $data_args = array() ) {
      Severity: Minor
      Found in wp-shortcode-cache/functions.php - About 35 mins to fix

        Method register_external_data_value has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function register_external_data_value( $tag, $data_identifier, $data_name, $data_type = 'global', $data_args = array() ) {
        Severity: Minor
        Found in wp-shortcode-cache/class-wp-shortcode-cache.php - About 35 mins to fix

          Processing form data without nonce verification.
          Open

                                  if ( isset( $_POST[ $params['name'] ] ) ) {

          Processing form data without nonce verification.
          Open

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

          You must use "/**" style comments for a file comment
          Open

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

          Missing wp_unslash() before sanitization.
          Open

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

          Empty line required before block comment
          Open

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

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

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

          Opening PHP tag must be on a line by itself
          Open

                      <?php printf(
          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

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

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

          Missing wp_unslash() before sanitization.
          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' );

          Expected 1 space after comma in function call; 9 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

          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

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

              add_filter( 'wp_shortcode_cache_use_cache_gallery',  '__return_false' );
          Severity
          Category
          Status
          Source
          Language