CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/meta.php

Summary

Maintainability
C
1 day
Test Coverage

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

function update_meta_cache($meta_type, $object_ids) {
    if ( empty( $meta_type ) || empty( $object_ids ) )
        return false;

    if ( ! $table = _get_meta_table($meta_type) )
Severity: Minor
Found in Web.Admin/2014/wordpress/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_meta_cache has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function update_meta_cache($meta_type, $object_ids) {
    if ( empty( $meta_type ) || empty( $object_ids ) )
        return false;

    if ( ! $table = _get_meta_table($meta_type) )
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/meta.php - About 1 hr to fix

    Function get_metadata has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {
        if ( !$meta_type )
            return false;
    
        $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/meta.php - About 55 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 delete_metadata has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
        if ( !$meta_type || !$meta_key || (!$delete_all && ! (int)$object_id) )
            return false;
    
        if ( ! $table = _get_meta_table($meta_type) )
    Severity: Minor
    Found in Web.Admin/2014/wordpress/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 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 Web.Admin/2014/wordpress/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 Web.Admin/2014/wordpress/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 Web.Admin/2014/wordpress/wp-includes/meta.php - About 35 mins to fix

          Avoid too many return statements within this method.
          Open

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

            Avoid too many return statements within this method.
            Open

                    return array();
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/meta.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return '';
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-includes/meta.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status