WordPress/WordPress

View on GitHub
wp-includes/meta.php

Summary

Maintainability
F
1 wk
Test Coverage

File meta.php has 694 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Core Metadata API
 *
 * Functions for retrieving and manipulating metadata of various WordPress object types. Metadata
Severity: Major
Found in wp-includes/meta.php - About 1 day to fix

    Function register_meta has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
        global $wp_meta_keys;
    
        if ( ! is_array( $wp_meta_keys ) ) {
            $wp_meta_keys = array();
    Severity: Minor
    Found in wp-includes/meta.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 register_meta has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
        global $wp_meta_keys;
    
        if ( ! is_array( $wp_meta_keys ) ) {
            $wp_meta_keys = array();
    Severity: Major
    Found in wp-includes/meta.php - About 3 hrs to fix

      Function update_meta_cache has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      function update_meta_cache( $meta_type, $object_ids ) {
          global $wpdb;
      
          if ( ! $meta_type || ! $object_ids ) {
              return false;
      Severity: Minor
      Found in wp-includes/meta.php - About 3 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 update_metadata has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_value = '' ) {
          global $wpdb;
      
          if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
              return false;
      Severity: Minor
      Found in wp-includes/meta.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

      Method update_metadata has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_value = '' ) {
          global $wpdb;
      
          if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
              return false;
      Severity: Major
      Found in wp-includes/meta.php - About 2 hrs to fix

        Function delete_metadata has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false ) {
            global $wpdb;
        
            if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) && ! $delete_all ) {
                return false;
        Severity: Minor
        Found in wp-includes/meta.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

        Method delete_metadata has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false ) {
            global $wpdb;
        
            if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) && ! $delete_all ) {
                return false;
        Severity: Major
        Found in wp-includes/meta.php - About 2 hrs to fix

          Method update_meta_cache has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function update_meta_cache( $meta_type, $object_ids ) {
              global $wpdb;
          
              if ( ! $meta_type || ! $object_ids ) {
                  return false;
          Severity: Major
          Found in wp-includes/meta.php - About 2 hrs to fix

            Function get_metadata_raw has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = false ) {
                if ( ! $meta_type || ! is_numeric( $object_id ) ) {
                    return false;
                }
            
            
            Severity: Minor
            Found in wp-includes/meta.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 filter_default_metadata has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            function filter_default_metadata( $value, $object_id, $meta_key, $single, $meta_type ) {
                global $wp_meta_keys;
            
                if ( wp_installing() ) {
                    return $value;
            Severity: Minor
            Found in wp-includes/meta.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

            Method update_metadata_by_mid has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false ) {
                global $wpdb;
            
                // Make sure everything is valid.
                if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
            Severity: Major
            Found in wp-includes/meta.php - About 2 hrs to fix

              Method add_metadata has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique = false ) {
                  global $wpdb;
              
                  if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
                      return false;
              Severity: Minor
              Found in wp-includes/meta.php - About 1 hr to fix

                Function update_metadata_by_mid has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false ) {
                    global $wpdb;
                
                    // Make sure everything is valid.
                    if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
                Severity: Minor
                Found in wp-includes/meta.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 unregister_meta_key has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) {
                    global $wp_meta_keys;
                
                    if ( ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) {
                        return false;
                Severity: Minor
                Found in wp-includes/meta.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 get_object_subtype has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function get_object_subtype( $object_type, $object_id ) {
                    $object_id      = (int) $object_id;
                    $object_subtype = '';
                
                    switch ( $object_type ) {
                Severity: Minor
                Found in wp-includes/meta.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 get_metadata_raw has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = false ) {
                    if ( ! $meta_type || ! is_numeric( $object_id ) ) {
                        return false;
                    }
                
                
                Severity: Minor
                Found in wp-includes/meta.php - About 1 hr to fix

                  Method delete_metadata_by_mid has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function delete_metadata_by_mid( $meta_type, $meta_id ) {
                      global $wpdb;
                  
                      // Make sure everything is valid.
                      if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
                  Severity: Minor
                  Found in wp-includes/meta.php - About 1 hr to fix

                    Method filter_default_metadata has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function filter_default_metadata( $value, $object_id, $meta_key, $single, $meta_type ) {
                        global $wp_meta_keys;
                    
                        if ( wp_installing() ) {
                            return $value;
                    Severity: Minor
                    Found in wp-includes/meta.php - About 1 hr to fix

                      Method get_object_subtype has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function get_object_subtype( $object_type, $object_id ) {
                          $object_id      = (int) $object_id;
                          $object_subtype = '';
                      
                          switch ( $object_type ) {
                      Severity: Minor
                      Found in wp-includes/meta.php - About 1 hr to fix

                        Function delete_metadata_by_mid has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function delete_metadata_by_mid( $meta_type, $meta_id ) {
                            global $wpdb;
                        
                            // Make sure everything is valid.
                            if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
                        Severity: Minor
                        Found in wp-includes/meta.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 unregister_meta_key has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) {
                            global $wp_meta_keys;
                        
                            if ( ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) {
                                return false;
                        Severity: Minor
                        Found in wp-includes/meta.php - About 1 hr to fix

                          Function add_metadata has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique = false ) {
                              global $wpdb;
                          
                              if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
                                  return false;
                          Severity: Minor
                          Found in wp-includes/meta.php - About 45 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

                          Function get_registered_metadata has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function get_registered_metadata( $object_type, $object_id, $meta_key = '' ) {
                              $object_subtype = get_object_subtype( $object_type, $object_id );
                          
                              if ( ! empty( $meta_key ) ) {
                                  if ( ! empty( $object_subtype ) && ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) {
                          Severity: Minor
                          Found in wp-includes/meta.php - About 45 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

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

                          function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) {
                          Severity: Minor
                          Found in wp-includes/meta.php - About 35 mins to fix

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

                            function filter_default_metadata( $value, $object_id, $meta_key, $single, $meta_type ) {
                            Severity: Minor
                            Found in wp-includes/meta.php - About 35 mins to fix

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

                              function delete_metadata( $meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false ) {
                              Severity: Minor
                              Found in wp-includes/meta.php - About 35 mins to fix

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

                                function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique = false ) {
                                Severity: Minor
                                Found in wp-includes/meta.php - About 35 mins to fix

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

                                  function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_value = '' ) {
                                  Severity: Minor
                                  Found in wp-includes/meta.php - About 35 mins to fix

                                    Function get_metadata_by_mid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function get_metadata_by_mid( $meta_type, $meta_id ) {
                                        global $wpdb;
                                    
                                        if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
                                            return false;
                                    Severity: Minor
                                    Found in wp-includes/meta.php - About 35 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

                                    Avoid too many return statements within this method.
                                    Open

                                        return false;
                                    Severity: Major
                                    Found in wp-includes/meta.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return false;
                                      Severity: Major
                                      Found in wp-includes/meta.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return false;
                                        Severity: Major
                                        Found in wp-includes/meta.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return false;
                                          Severity: Major
                                          Found in wp-includes/meta.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                return false;
                                            Severity: Major
                                            Found in wp-includes/meta.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                      return true;
                                              Severity: Major
                                              Found in wp-includes/meta.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                return false;
                                                Severity: Major
                                                Found in wp-includes/meta.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                          return false;
                                                  Severity: Major
                                                  Found in wp-includes/meta.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                        return $meta;
                                                    Severity: Major
                                                    Found in wp-includes/meta.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                              return $result;
                                                      Severity: Major
                                                      Found in wp-includes/meta.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                            return false;
                                                        Severity: Major
                                                        Found in wp-includes/meta.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  return $meta_cache;
                                                          Severity: Major
                                                          Found in wp-includes/meta.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                    return add_metadata( $meta_type, $object_id, $raw_meta_key, $passed_value );
                                                            Severity: Major
                                                            Found in wp-includes/meta.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                      return false;
                                                              Severity: Major
                                                              Found in wp-includes/meta.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                    return $mid;
                                                                Severity: Major
                                                                Found in wp-includes/meta.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                      return true;
                                                                  Severity: Major
                                                                  Found in wp-includes/meta.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                return maybe_unserialize( $meta_cache[ $meta_key ][0] );
                                                                    Severity: Major
                                                                    Found in wp-includes/meta.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                          return $cache;
                                                                      Severity: Major
                                                                      Found in wp-includes/meta.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                            return $value;
                                                                        Severity: Major
                                                                        Found in wp-includes/meta.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                  return false;
                                                                          Severity: Major
                                                                          Found in wp-includes/meta.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                    return false;
                                                                            Severity: Major
                                                                            Found in wp-includes/meta.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                      return false;
                                                                              Severity: Major
                                                                              Found in wp-includes/meta.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                    return false;
                                                                                Severity: Major
                                                                                Found in wp-includes/meta.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                      return true;
                                                                                  Severity: Major
                                                                                  Found in wp-includes/meta.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                return array_map( 'maybe_unserialize', $meta_cache[ $meta_key ] );
                                                                                    Severity: Major
                                                                                    Found in wp-includes/meta.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                          return null;
                                                                                      Severity: Major
                                                                                      Found in wp-includes/meta.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                return true;
                                                                                        Severity: Major
                                                                                        Found in wp-includes/meta.php - About 30 mins to fix

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

                                                                                          function metadata_exists( $meta_type, $object_id, $meta_key ) {
                                                                                              if ( ! $meta_type || ! is_numeric( $object_id ) ) {
                                                                                                  return false;
                                                                                              }
                                                                                          
                                                                                          
                                                                                          Severity: Minor
                                                                                          Found in wp-includes/meta.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

                                                                                          There are no issues that match your filters.

                                                                                          Category
                                                                                          Status