CaffGeek/MBACNationals

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

Summary

Maintainability
F
2 wks
Test Coverage

File taxonomy.php has 1144 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Taxonomy API
 *
 * @package WordPress
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 2 days to fix

    Function get_terms has a Cognitive Complexity of 119 (exceeds 5 allowed). Consider refactoring.
    Open

    function &get_terms($taxonomies, $args = '') {
        global $wpdb;
        $empty_array = array();
    
        $single_taxonomy = false;
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 2 days 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 wp_get_object_terms has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
        global $wpdb;
    
        if ( !is_array($taxonomies) )
            $taxonomies = array($taxonomies);
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 day 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_terms has 194 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function &get_terms($taxonomies, $args = '') {
        global $wpdb;
        $empty_array = array();
    
        $single_taxonomy = false;
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 7 hrs to fix

      Function _get_term_children has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      function &_get_term_children($term_id, $terms, $taxonomy) {
          $empty_array = array();
          if ( empty($terms) )
              return $empty_array;
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 wp_set_object_terms has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
          global $wpdb;
      
          $object_id = (int) $object_id;
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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_object_term_cache has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      function update_object_term_cache($object_ids, $object_type) {
          if ( empty($object_ids) )
              return;
      
          if ( !is_array($object_ids) )
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 sanitize_term_field has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
          if ( 'parent' == $field  || 'term_id' == $field || 'count' == $field || 'term_group' == $field ) {
              $value = (int) $value;
              if ( $value < 0 )
                  $value = 0;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 is_object_in_term has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
          if ( !$object_id = (int) $object_id )
              return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) );
      
          $object_terms = get_object_term_cache( $object_id, $taxonomy );
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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

      Method wp_get_object_terms has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
          global $wpdb;
      
          if ( !is_array($taxonomies) )
              $taxonomies = array($taxonomies);
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 2 hrs to fix

        Function wp_insert_term has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        function wp_insert_term( $term, $taxonomy, $args = array() ) {
            global $wpdb;
        
            if ( ! is_taxonomy($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 wp_update_term has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function wp_update_term( $term_id, $taxonomy, $args = array() ) {
            global $wpdb;
        
            if ( ! is_taxonomy($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 2 hrs to fix

          Method wp_insert_term has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function wp_insert_term( $term, $taxonomy, $args = array() ) {
              global $wpdb;
          
              if ( ! is_taxonomy($taxonomy) )
                  return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 2 hrs to fix

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

            function _pad_term_counts(&$terms, $taxonomy) {
                global $wpdb;
            
                // This function only works for hierarchical taxonomies like post categories.
                if ( !is_taxonomy_hierarchical( $taxonomy ) )
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 wp_delete_term has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            function wp_delete_term( $term, $taxonomy, $args = array() ) {
                global $wpdb;
            
                $term = (int) $term;
            
            
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 get_the_taxonomies has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function get_the_taxonomies($post = 0) {
                if ( is_int($post) )
                    $post =& get_post($post);
                elseif ( !is_object($post) )
                    $post =& $GLOBALS['post'];
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 get_term has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
                global $wpdb;
                $null = null;
            
                if ( empty($term) ) {
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 wp_unique_term_slug has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function wp_unique_term_slug($slug, $term) {
                global $wpdb;
            
                // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
                // by incorporating parent slugs.
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 wp_set_object_terms has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
                global $wpdb;
            
                $object_id = (int) $object_id;
            
            
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 2 hrs to fix

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

              function wp_update_term( $term_id, $taxonomy, $args = array() ) {
                  global $wpdb;
              
                  if ( ! is_taxonomy($taxonomy) )
                      return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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_delete_term has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function wp_delete_term( $term, $taxonomy, $args = array() ) {
                  global $wpdb;
              
                  $term = (int) $term;
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                Function sanitize_term has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function sanitize_term($term, $taxonomy, $context = 'display') {
                
                    if ( 'raw' == $context )
                        return $term;
                
                
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 is_term has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function is_term($term, $taxonomy = '', $parent = 0) {
                    global $wpdb;
                
                    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
                    $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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_term_by has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
                    global $wpdb;
                
                    if ( ! is_taxonomy($taxonomy) )
                        return false;
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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_term has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
                    global $wpdb;
                    $null = null;
                
                    if ( empty($term) ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                  Method is_term has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function is_term($term, $taxonomy = '', $parent = 0) {
                      global $wpdb;
                  
                      $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
                      $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

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

                    function get_term_link( $term, $taxonomy ) {
                        global $wp_rewrite;
                    
                        if ( !is_object($term) ) {
                            if ( is_int($term) ) {
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 update_object_term_cache has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function update_object_term_cache($object_ids, $object_type) {
                        if ( empty($object_ids) )
                            return;
                    
                        if ( !is_array($object_ids) )
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                      Function clean_term_cache has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function clean_term_cache($ids, $taxonomy = '') {
                          global $wpdb;
                          static $cleaned = array();
                      
                          if ( !is_array($ids) )
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 register_taxonomy has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
                          global $wp_taxonomies, $wp_rewrite, $wp;
                      
                          if (!is_array($wp_taxonomies))
                              $wp_taxonomies = array();
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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 sanitize_term_field has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
                          if ( 'parent' == $field  || 'term_id' == $field || 'count' == $field || 'term_group' == $field ) {
                              $value = (int) $value;
                              if ( $value < 0 )
                                  $value = 0;
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                        Method _get_term_children has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function &_get_term_children($term_id, $terms, $taxonomy) {
                            $empty_array = array();
                            if ( empty($terms) )
                                return $empty_array;
                        
                        
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                          Method get_term_by has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
                              global $wpdb;
                          
                              if ( ! is_taxonomy($taxonomy) )
                                  return false;
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                            Method _pad_term_counts has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function _pad_term_counts(&$terms, $taxonomy) {
                                global $wpdb;
                            
                                // This function only works for hierarchical taxonomies like post categories.
                                if ( !is_taxonomy_hierarchical( $taxonomy ) )
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                              Method clean_term_cache has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function clean_term_cache($ids, $taxonomy = '') {
                                  global $wpdb;
                                  static $cleaned = array();
                              
                                  if ( !is_array($ids) )
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                                Method get_term_link has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function get_term_link( $term, $taxonomy ) {
                                    global $wp_rewrite;
                                
                                    if ( !is_object($term) ) {
                                        if ( is_int($term) ) {
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                                  Method wp_unique_term_slug has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function wp_unique_term_slug($slug, $term) {
                                      global $wpdb;
                                  
                                      // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
                                      // by incorporating parent slugs.
                                  Severity: Minor
                                  Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

                                    Method get_the_taxonomies has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function get_the_taxonomies($post = 0) {
                                        if ( is_int($post) )
                                            $post =& get_post($post);
                                        elseif ( !is_object($post) )
                                            $post =& $GLOBALS['post'];
                                    Severity: Minor
                                    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 1 hr to fix

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

                                      function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {
                                          static $_deferred = array();
                                      
                                          if ( $do_deferred ) {
                                              foreach ( (array) array_keys($_deferred) as $tax ) {
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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_term_by has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
                                      Severity: Minor
                                      Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 35 mins to fix

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

                                        function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
                                        Severity: Minor
                                        Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 35 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $else_where_fields), ARRAY_A);
                                          Severity: Major
                                          Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                    return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
                                            Severity: Major
                                            Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

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

                                                Avoid too many return statements within this method.
                                                Open

                                                            return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
                                                Severity: Major
                                                Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                      return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
                                                  Severity: Major
                                                  Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

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

                                                      Avoid too many return statements within this method.
                                                      Open

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

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                if ( $ints && in_array( $object_term->term_id, $ints ) ) return true; // If int, check against term_id
                                                        Severity: Major
                                                        Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  return array_values(get_object_vars($term));
                                                          Severity: Major
                                                          Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        if ( in_array( $object_term->term_id, $strs ) ) return true;
                                                            Severity: Major
                                                            Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                          if ( in_array( $object_term->slug, $strs ) )    return true;
                                                              Severity: Major
                                                              Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                            if ( in_array( $object_term->name, $strs ) )    return true;
                                                                Severity: Major
                                                                Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

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

                                                                    Avoid too many return statements within this method.
                                                                    Open

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

                                                                      Avoid too many return statements within this method.
                                                                      Open

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

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                            return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $else_where_fields) );
                                                                        Severity: Major
                                                                        Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

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

                                                                            Avoid too many return statements within this method.
                                                                            Open

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

                                                                              Avoid too many return statements within this method.
                                                                              Open

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

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                    return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
                                                                                Severity: Major
                                                                                Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

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

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

                                                                                    function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
                                                                                        global $wpdb;
                                                                                    
                                                                                        if ( !is_array( $terms) )
                                                                                            $terms = array($terms);
                                                                                    Severity: Minor
                                                                                    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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

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

                                                                                    function get_object_taxonomies($object) {
                                                                                        global $wp_taxonomies;
                                                                                    
                                                                                        if ( is_object($object) ) {
                                                                                            if ( $object->post_type == 'attachment' )
                                                                                    Severity: Minor
                                                                                    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.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

                                                                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                    Open

                                                                                        if ( $alias_of ) {
                                                                                            $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) );
                                                                                            if ( $alias->term_group ) {
                                                                                                // The alias we want is already in a group, so let's use that one.
                                                                                                $term_group = $alias->term_group;
                                                                                    Severity: Major
                                                                                    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php and 1 other location - About 2 hrs to fix
                                                                                    Web.Admin/2014/wordpress/wp-includes/taxonomy.php on lines 1382..1394

                                                                                    Duplicated Code

                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                    Tuning

                                                                                    This issue has a mass of 136.

                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                    Refactorings

                                                                                    Further Reading

                                                                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                    Open

                                                                                        if ( $alias_of ) {
                                                                                            $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) );
                                                                                            if ( $alias->term_group ) {
                                                                                                // The alias we want is already in a group, so let's use that one.
                                                                                                $term_group = $alias->term_group;
                                                                                    Severity: Major
                                                                                    Found in Web.Admin/2014/wordpress/wp-includes/taxonomy.php and 1 other location - About 2 hrs to fix
                                                                                    Web.Admin/2014/wordpress/wp-includes/taxonomy.php on lines 1659..1671

                                                                                    Duplicated Code

                                                                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                    Tuning

                                                                                    This issue has a mass of 136.

                                                                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                    Refactorings

                                                                                    Further Reading

                                                                                    There are no issues that match your filters.

                                                                                    Category
                                                                                    Status