WordPress/WordPress

View on GitHub
wp-includes/class-wpdb.php

Summary

Maintainability
F
2 wks
Test Coverage

File class-wpdb.php has 1718 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WordPress database access abstraction class.
 *
 * Original code from {@link http://php.justinvincent.com Justin Vincent (justin@visunet.ie)}
Severity: Major
Found in wp-includes/class-wpdb.php - About 4 days to fix

    Function prepare has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
    Open

        public function prepare( $query, ...$args ) {
            if ( is_null( $query ) ) {
                return;
            }
    
    
    Severity: Minor
    Found in wp-includes/class-wpdb.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

    Function strip_invalid_text has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function strip_invalid_text( $data ) {
            $db_check_string = false;
    
            foreach ( $data as &$value ) {
                $charset = $value['charset'];
    Severity: Minor
    Found in wp-includes/class-wpdb.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

    wpdb has 72 functions (exceeds 20 allowed). Consider refactoring.
    Open

    #[AllowDynamicProperties]
    class wpdb {
    
        /**
         * Whether to show SQL/DB errors.
    Severity: Major
    Found in wp-includes/class-wpdb.php - About 1 day to fix

      Method prepare has 169 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function prepare( $query, ...$args ) {
              if ( is_null( $query ) ) {
                  return;
              }
      
      
      Severity: Major
      Found in wp-includes/class-wpdb.php - About 6 hrs to fix

        Function get_results has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            public function get_results( $query = null, $output = OBJECT ) {
                $this->func_call = "\$db->get_results(\"$query\", $output)";
        
                if ( $query ) {
                    if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
        Severity: Minor
        Found in wp-includes/class-wpdb.php - About 4 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 strip_invalid_text has 107 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function strip_invalid_text( $data ) {
                $db_check_string = false;
        
                foreach ( $data as &$value ) {
                    $charset = $value['charset'];
        Severity: Major
        Found in wp-includes/class-wpdb.php - About 4 hrs to fix

          Function query has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

              public function query( $query ) {
                  if ( ! $this->ready ) {
                      $this->check_current_query = true;
                      return false;
                  }
          Severity: Minor
          Found in wp-includes/class-wpdb.php - About 4 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 tables has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              public function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) {
                  switch ( $scope ) {
                      case 'all':
                          $tables = array_merge( $this->global_tables, $this->tables );
                          if ( is_multisite() ) {
          Severity: Minor
          Found in wp-includes/class-wpdb.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 query has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function query( $query ) {
                  if ( ! $this->ready ) {
                      $this->check_current_query = true;
                      return false;
                  }
          Severity: Major
          Found in wp-includes/class-wpdb.php - About 2 hrs to fix

            Method get_col_length has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function get_col_length( $table, $column ) {
                    $tablekey  = strtolower( $table );
                    $columnkey = strtolower( $column );
            
                    // Skip this entirely if this isn't a MySQL database.
            Severity: Major
            Found in wp-includes/class-wpdb.php - About 2 hrs to fix

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

                  protected function get_table_charset( $table ) {
                      $tablekey = strtolower( $table );
              
                      /**
                       * Filters the table charset value before the DB is checked.
              Severity: Minor
              Found in wp-includes/class-wpdb.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 db_connect has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function db_connect( $allow_bail = true ) {
                      $this->is_mysql = true;
              
                      $client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0;
              
              
              Severity: Major
              Found in wp-includes/class-wpdb.php - About 2 hrs to fix

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

                    protected function get_table_charset( $table ) {
                        $tablekey = strtolower( $table );
                
                        /**
                         * Filters the table charset value before the DB is checked.
                Severity: Major
                Found in wp-includes/class-wpdb.php - About 2 hrs to fix

                  Method tables has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) {
                          switch ( $scope ) {
                              case 'all':
                                  $tables = array_merge( $this->global_tables, $this->tables );
                                  if ( is_multisite() ) {
                  Severity: Major
                  Found in wp-includes/class-wpdb.php - About 2 hrs to fix

                    Method print_error has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function print_error( $str = '' ) {
                            global $EZSQL_ERROR;
                    
                            if ( ! $str ) {
                                $str = mysqli_error( $this->dbh );
                    Severity: Minor
                    Found in wp-includes/class-wpdb.php - About 1 hr to fix

                      Method get_table_from_query has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function get_table_from_query( $query ) {
                              // Remove characters that can legally trail the table name.
                              $query = rtrim( $query, ';/-#' );
                      
                              // Allow (select...) union [...] style queries. Use the first query's table name.
                      Severity: Minor
                      Found in wp-includes/class-wpdb.php - About 1 hr to fix

                        Method check_connection has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function check_connection( $allow_bail = true ) {
                                if ( ! empty( $this->dbh ) && mysqli_ping( $this->dbh ) ) {
                                    return true;
                                }
                        
                        
                        Severity: Minor
                        Found in wp-includes/class-wpdb.php - About 1 hr to fix

                          Method check_safe_collation has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function check_safe_collation( $query ) {
                                  if ( $this->checking_collation ) {
                                      return true;
                                  }
                          
                          
                          Severity: Minor
                          Found in wp-includes/class-wpdb.php - About 1 hr to fix

                            Method get_results has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function get_results( $query = null, $output = OBJECT ) {
                                    $this->func_call = "\$db->get_results(\"$query\", $output)";
                            
                                    if ( $query ) {
                                        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
                            Severity: Minor
                            Found in wp-includes/class-wpdb.php - About 1 hr to fix

                              Function check_connection has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function check_connection( $allow_bail = true ) {
                                      if ( ! empty( $this->dbh ) && mysqli_ping( $this->dbh ) ) {
                                          return true;
                                      }
                              
                              
                              Severity: Minor
                              Found in wp-includes/class-wpdb.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 check_safe_collation has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function check_safe_collation( $query ) {
                                      if ( $this->checking_collation ) {
                                          return true;
                                      }
                              
                              
                              Severity: Minor
                              Found in wp-includes/class-wpdb.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 set_prefix has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function set_prefix( $prefix, $set_table_names = true ) {
                              
                                      if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) {
                                          return new WP_Error( 'invalid_db_prefix', 'Invalid database prefix' );
                                      }
                              Severity: Minor
                              Found in wp-includes/class-wpdb.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 db_connect has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function db_connect( $allow_bail = true ) {
                                      $this->is_mysql = true;
                              
                                      $client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0;
                              
                              
                              Severity: Minor
                              Found in wp-includes/class-wpdb.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 process_fields has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function process_fields( $table, $data, $format ) {
                                      $data = $this->process_field_formats( $data, $format );
                                      if ( false === $data ) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in wp-includes/class-wpdb.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 update has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function update( $table, $data, $where, $format = null, $where_format = null ) {
                                      if ( ! is_array( $data ) || ! is_array( $where ) ) {
                                          return false;
                                      }
                              
                              
                              Severity: Minor
                              Found in wp-includes/class-wpdb.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 process_fields has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function process_fields( $table, $data, $format ) {
                                      $data = $this->process_field_formats( $data, $format );
                                      if ( false === $data ) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in wp-includes/class-wpdb.php - About 1 hr to fix

                                Method update has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function update( $table, $data, $where, $format = null, $where_format = null ) {
                                        if ( ! is_array( $data ) || ! is_array( $where ) ) {
                                            return false;
                                        }
                                
                                
                                Severity: Minor
                                Found in wp-includes/class-wpdb.php - About 1 hr to fix

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

                                      public function select( $db, $dbh = null ) {
                                          if ( is_null( $dbh ) ) {
                                              $dbh = $this->dbh;
                                          }
                                  
                                  
                                  Severity: Minor
                                  Found in wp-includes/class-wpdb.php - About 1 hr to fix

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

                                        public function set_charset( $dbh, $charset = null, $collate = null ) {
                                            if ( ! isset( $charset ) ) {
                                                $charset = $this->charset;
                                            }
                                            if ( ! isset( $collate ) ) {
                                    Severity: Minor
                                    Found in wp-includes/class-wpdb.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 print_error has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        public function print_error( $str = '' ) {
                                            global $EZSQL_ERROR;
                                    
                                            if ( ! $str ) {
                                                $str = mysqli_error( $this->dbh );
                                    Severity: Minor
                                    Found in wp-includes/class-wpdb.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_row has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        public function get_row( $query = null, $output = OBJECT, $y = 0 ) {
                                            $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
                                    
                                            if ( $query ) {
                                                if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
                                    Severity: Minor
                                    Found in wp-includes/class-wpdb.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 bail has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        public function bail( $message, $error_code = '500' ) {
                                            if ( $this->show_errors ) {
                                                $error = '';
                                    
                                                if ( $this->dbh instanceof mysqli ) {
                                    Severity: Minor
                                    Found in wp-includes/class-wpdb.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 set_sql_mode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        public function set_sql_mode( $modes = array() ) {
                                            if ( empty( $modes ) ) {
                                                $res = mysqli_query( $this->dbh, 'SELECT @@SESSION.sql_mode' );
                                    
                                                if ( empty( $res ) ) {
                                    Severity: Minor
                                    Found in wp-includes/class-wpdb.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 escape has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        public function escape( $data ) {
                                            if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) ) {
                                                _deprecated_function( __METHOD__, '3.6.0', 'wpdb::prepare() or esc_sql()' );
                                            }
                                            if ( is_array( $data ) ) {
                                    Severity: Minor
                                    Found in wp-includes/class-wpdb.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 strip_invalid_text_from_query has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function strip_invalid_text_from_query( $query ) {
                                            // We don't need to check the collation for queries that don't read data.
                                            $trimmed_query = ltrim( $query, "\r\n\t (" );
                                            if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $trimmed_query ) ) {
                                                return $query;
                                    Severity: Minor
                                    Found in wp-includes/class-wpdb.php - About 1 hr to fix

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

                                          public function get_col_charset( $table, $column ) {
                                              $tablekey  = strtolower( $table );
                                              $columnkey = strtolower( $column );
                                      
                                              /**
                                      Severity: Minor
                                      Found in wp-includes/class-wpdb.php - About 1 hr to fix

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

                                            public function determine_charset( $charset, $collate ) {
                                                if ( ( ! ( $this->dbh instanceof mysqli ) ) || empty( $this->dbh ) ) {
                                                    return compact( 'charset', 'collate' );
                                                }
                                        
                                        
                                        Severity: Minor
                                        Found in wp-includes/class-wpdb.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 get_blog_prefix has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function get_blog_prefix( $blog_id = null ) {
                                                if ( is_multisite() ) {
                                                    if ( null === $blog_id ) {
                                                        $blog_id = $this->blogid;
                                                    }
                                        Severity: Minor
                                        Found in wp-includes/class-wpdb.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 get_col_length has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function get_col_length( $table, $column ) {
                                                $tablekey  = strtolower( $table );
                                                $columnkey = strtolower( $column );
                                        
                                                // Skip this entirely if this isn't a MySQL database.
                                        Severity: Minor
                                        Found in wp-includes/class-wpdb.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 strip_invalid_text_from_query has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function strip_invalid_text_from_query( $query ) {
                                                // We don't need to check the collation for queries that don't read data.
                                                $trimmed_query = ltrim( $query, "\r\n\t (" );
                                                if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $trimmed_query ) ) {
                                                    return $query;
                                        Severity: Minor
                                        Found in wp-includes/class-wpdb.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 _escape has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function _escape( $data ) {
                                                if ( is_array( $data ) ) {
                                                    foreach ( $data as $k => $v ) {
                                                        if ( is_array( $v ) ) {
                                                            $data[ $k ] = $this->_escape( $v );
                                        Severity: Minor
                                        Found in wp-includes/class-wpdb.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 process_field_charsets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function process_field_charsets( $data, $table ) {
                                                foreach ( $data as $field => $value ) {
                                                    if ( '%d' === $value['format'] || '%f' === $value['format'] ) {
                                                        /*
                                                         * We can skip this field if we know it isn't a string.
                                        Severity: Minor
                                        Found in wp-includes/class-wpdb.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_col_charset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function get_col_charset( $table, $column ) {
                                                $tablekey  = strtolower( $table );
                                                $columnkey = strtolower( $column );
                                        
                                                /**
                                        Severity: Minor
                                        Found in wp-includes/class-wpdb.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 process_field_lengths has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            protected function process_field_lengths( $data, $table ) {
                                                foreach ( $data as $field => $value ) {
                                                    if ( '%d' === $value['format'] || '%f' === $value['format'] ) {
                                                        /*
                                                         * We can skip this field if we know it isn't a string.
                                        Severity: Minor
                                        Found in wp-includes/class-wpdb.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 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                            public function update( $table, $data, $where, $format = null, $where_format = null ) {
                                        Severity: Minor
                                        Found in wp-includes/class-wpdb.php - About 35 mins to fix

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

                                              public function log_query( $query, $query_time, $query_callstack, $query_start, $query_data ) {
                                          Severity: Minor
                                          Found in wp-includes/class-wpdb.php - About 35 mins to fix

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

                                                public function get_col_info( $info_type = 'name', $col_offset = -1 ) {
                                                    $this->load_col_info();
                                            
                                                    if ( $this->col_info ) {
                                                        if ( -1 === $col_offset ) {
                                            Severity: Minor
                                            Found in wp-includes/class-wpdb.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

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

                                                public function init_charset() {
                                                    $charset = '';
                                                    $collate = '';
                                            
                                                    if ( function_exists( 'is_multisite' ) && is_multisite() ) {
                                            Severity: Minor
                                            Found in wp-includes/class-wpdb.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

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

                                                protected function process_field_formats( $data, $format ) {
                                                    $formats          = (array) $format;
                                                    $original_formats = $formats;
                                            
                                                    foreach ( $data as $field => $value ) {
                                            Severity: Minor
                                            Found in wp-includes/class-wpdb.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

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

                                                public function get_col( $query = null, $x = 0 ) {
                                                    if ( $query ) {
                                                        if ( $this->check_current_query && $this->check_safe_collation( $query ) ) {
                                                            $this->check_current_query = false;
                                                        }
                                            Severity: Minor
                                            Found in wp-includes/class-wpdb.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 $this->last_result[ $y ] ? array_values( get_object_vars( $this->last_result[ $y ] ) ) : null;
                                            Severity: Major
                                            Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                          return $this->last_result[ $y ] ? $this->last_result[ $y ] : null;
                                              Severity: Major
                                              Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

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

                                                  Avoid too many return statements within this method.
                                                  Open

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

                                                    Avoid too many return statements within this method.
                                                    Open

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

                                                      Avoid too many return statements within this method.
                                                      Open

                                                              return $this->add_placeholder_escape( $query );
                                                      Severity: Major
                                                      Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                return $data[0]['value'];
                                                        Severity: Major
                                                        Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

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

                                                            Avoid too many return statements within this method.
                                                            Open

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

                                                              Avoid too many return statements within this method.
                                                              Open

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

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                return array(
                                                                                    'type'   => 'byte',
                                                                                    'length' => 65535,      // 2^16 - 1
                                                                                );
                                                                Severity: Major
                                                                Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

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

                                                                    Avoid too many return statements within this method.
                                                                    Open

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

                                                                      Avoid too many return statements within this method.
                                                                      Open

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

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                        return array(
                                                                                            'type'   => 'byte',
                                                                                            'length' => (int) $length,
                                                                                        );
                                                                        Severity: Major
                                                                        Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

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

                                                                            Avoid too many return statements within this method.
                                                                            Open

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

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                              return array(
                                                                                                  'type'   => 'byte',
                                                                                                  'length' => 255,        // 2^8 - 1
                                                                                              );
                                                                              Severity: Major
                                                                              Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                                return array(
                                                                                                    'type'   => 'byte',
                                                                                                    'length' => 16777215,   // 2^24 - 1
                                                                                                );
                                                                                Severity: Major
                                                                                Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                              return $this->last_result;
                                                                                  Severity: Major
                                                                                  Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                    return array(
                                                                                                        'type'   => 'byte',
                                                                                                        'length' => 4294967295, // 2^32 - 1
                                                                                                    );
                                                                                    Severity: Major
                                                                                    Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

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

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

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

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                  return $data[ $column ]['value'];
                                                                                          Severity: Major
                                                                                          Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                        return $this->table_charset[ $tablekey ];
                                                                                            Severity: Major
                                                                                            Found in wp-includes/class-wpdb.php - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

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

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

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

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

                                                                                                      public function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) {
                                                                                                          $this->insert_id = 0;
                                                                                                  
                                                                                                          if ( ! in_array( strtoupper( $type ), array( 'REPLACE', 'INSERT' ), true ) ) {
                                                                                                              return false;
                                                                                                  Severity: Minor
                                                                                                  Found in wp-includes/class-wpdb.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 flush has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      public function flush() {
                                                                                                          $this->last_result   = array();
                                                                                                          $this->col_info      = null;
                                                                                                          $this->last_query    = null;
                                                                                                          $this->rows_affected = 0;
                                                                                                  Severity: Minor
                                                                                                  Found in wp-includes/class-wpdb.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      public function delete( $table, $where, $where_format = null ) {
                                                                                                          if ( ! is_array( $where ) ) {
                                                                                                              return false;
                                                                                                          }
                                                                                                  
                                                                                                  
                                                                                                  Severity: Minor
                                                                                                  Found in wp-includes/class-wpdb.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

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

                                                                                                      protected function process_field_lengths( $data, $table ) {
                                                                                                          foreach ( $data as $field => $value ) {
                                                                                                              if ( '%d' === $value['format'] || '%f' === $value['format'] ) {
                                                                                                                  /*
                                                                                                                   * We can skip this field if we know it isn't a string.
                                                                                                  Severity: Major
                                                                                                  Found in wp-includes/class-wpdb.php and 1 other location - About 1 hr to fix
                                                                                                  wp-includes/class-wpdb.php on lines 2923..2942

                                                                                                  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 118.

                                                                                                  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

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

                                                                                                      protected function process_field_charsets( $data, $table ) {
                                                                                                          foreach ( $data as $field => $value ) {
                                                                                                              if ( '%d' === $value['format'] || '%f' === $value['format'] ) {
                                                                                                                  /*
                                                                                                                   * We can skip this field if we know it isn't a string.
                                                                                                  Severity: Major
                                                                                                  Found in wp-includes/class-wpdb.php and 1 other location - About 1 hr to fix
                                                                                                  wp-includes/class-wpdb.php on lines 2982..3001

                                                                                                  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 118.

                                                                                                  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