felixarntz/wp-shortcode-cache

View on GitHub

Showing 7 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

          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