woothemes/woocommerce

View on GitHub
includes/wc-update-functions.php

Summary

Maintainability
F
1 wk
Test Coverage

File wc-update-functions.php has 1486 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WooCommerce Updates
 *
 * Functions for updating data, used by the background updater.
Severity: Major
Found in includes/wc-update-functions.php - About 3 days to fix

    Function wc_update_200_line_items has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    function wc_update_200_line_items() {
        global $wpdb;
    
        // Now its time for the massive update to line items - move them to the new DB tables.
        // Reverse with UPDATE `wpwc_postmeta` SET meta_key = '_order_items' WHERE meta_key = '_order_items_old'.
    Severity: Minor
    Found in includes/wc-update-functions.php - About 7 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 wc_update_240_shipping_methods has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    function wc_update_240_shipping_methods() {
        /**
         * Flat Rate Shipping.
         * Update legacy options to new math based options.
         */
    Severity: Minor
    Found in includes/wc-update-functions.php - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function wc_update_200_taxrates has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function wc_update_200_taxrates() {
        global $wpdb;
    
        // Update tax rates.
        $loop      = 0;
    Severity: Minor
    Found in includes/wc-update-functions.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 wc_update_200_line_items has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wc_update_200_line_items() {
        global $wpdb;
    
        // Now its time for the massive update to line items - move them to the new DB tables.
        // Reverse with UPDATE `wpwc_postmeta` SET meta_key = '_order_items' WHERE meta_key = '_order_items_old'.
    Severity: Major
    Found in includes/wc-update-functions.php - About 4 hrs to fix

      Method wc_update_220_order_status has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function wc_update_220_order_status() {
          global $wpdb;
          $wpdb->query(
              "UPDATE {$wpdb->posts} as posts
              LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id
      Severity: Major
      Found in includes/wc-update-functions.php - About 3 hrs to fix

        Method wc_update_340_states has 74 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function wc_update_340_states() {
            $country_states = array(
                'IE' => array(
                    'CK' => 'CO',
                    'DN' => 'D',
        Severity: Major
        Found in includes/wc-update-functions.php - About 2 hrs to fix

          Method wc_update_200_taxrates has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function wc_update_200_taxrates() {
              global $wpdb;
          
              // Update tax rates.
              $loop      = 0;
          Severity: Major
          Found in includes/wc-update-functions.php - About 2 hrs to fix

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

            function wc_update_210_file_paths() {
                global $wpdb;
            
                // Upgrade file paths to support multiple file paths + names etc.
                $existing_file_paths = $wpdb->get_results( "SELECT meta_value, meta_id FROM {$wpdb->postmeta} WHERE meta_key = '_file_paths' AND meta_value != '';" );
            Severity: Minor
            Found in includes/wc-update-functions.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 wc_update_320_mexican_states has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function wc_update_320_mexican_states() {
                global $wpdb;
            
                $mx_states = array(
                    'Distrito Federal'    => 'CMX',
            Severity: Major
            Found in includes/wc-update-functions.php - About 2 hrs to fix

              Method wc_update_240_shipping_methods has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function wc_update_240_shipping_methods() {
                  /**
                   * Flat Rate Shipping.
                   * Update legacy options to new math based options.
                   */
              Severity: Major
              Found in includes/wc-update-functions.php - About 2 hrs to fix

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

                function wc_update_260_zone_methods() {
                    global $wpdb;
                
                    /**
                     * Shipping zones in WC 2.6.0 use a table named woocommerce_shipping_zone_methods.
                Severity: Major
                Found in includes/wc-update-functions.php - About 2 hrs to fix

                  Method wc_update_340_state has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function wc_update_340_state() {
                      global $wpdb;
                  
                      $country_states = array_filter( (array) get_option( 'woocommerce_update_340_states', array() ) );
                  
                  
                  Severity: Minor
                  Found in includes/wc-update-functions.php - About 1 hr to fix

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

                    function wc_update_450_sanitize_coupons_code() {
                        global $wpdb;
                    
                        $coupon_id      = 0;
                        $last_coupon_id = get_option( 'woocommerce_update_450_last_coupon_id', '0' );
                    Severity: Minor
                    Found in includes/wc-update-functions.php - About 1 hr to fix

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

                      function wc_update_209_brazillian_state() {
                          global $wpdb;
                      
                          // phpcs:disable WordPress.DB.SlowDBQuery
                      
                      
                      Severity: Minor
                      Found in includes/wc-update-functions.php - About 1 hr to fix

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

                        function wc_update_500_fix_product_review_count() {
                            global $wpdb;
                        
                            $product_id      = 0;
                            $last_product_id = get_option( 'woocommerce_update_500_last_product_id', '0' );
                        Severity: Minor
                        Found in includes/wc-update-functions.php - About 1 hr to fix

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

                          function wc_update_330_image_options() {
                              $old_thumbnail_size = get_option( 'shop_catalog_image_size', array() );
                              $old_single_size    = get_option( 'shop_single_image_size', array() );
                          
                              if ( ! empty( $old_thumbnail_size['width'] ) ) {
                          Severity: Minor
                          Found in includes/wc-update-functions.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 wc_update_300_product_visibility has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function wc_update_300_product_visibility() {
                              global $wpdb;
                          
                              WC_Install::create_terms();
                          
                          
                          Severity: Minor
                          Found in includes/wc-update-functions.php - About 1 hr to fix

                            Method wc_update_240_refunds has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function wc_update_240_refunds() {
                                global $wpdb;
                                /**
                                 * Refunds for full refunded orders.
                                 * Update fully refunded orders to ensure they have a refund line item so reports add up.
                            Severity: Minor
                            Found in includes/wc-update-functions.php - About 1 hr to fix

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

                              function wc_update_240_api_keys() {
                                  global $wpdb;
                                  /**
                                   * Update the old user API keys to the new Apps keys.
                                   */
                              Severity: Minor
                              Found in includes/wc-update-functions.php - About 1 hr to fix

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

                                function wc_update_260_zone_methods() {
                                    global $wpdb;
                                
                                    /**
                                     * Shipping zones in WC 2.6.0 use a table named woocommerce_shipping_zone_methods.
                                Severity: Minor
                                Found in includes/wc-update-functions.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 wc_update_200_permalinks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function wc_update_200_permalinks() {
                                    // Setup default permalinks if shop page is defined.
                                    $permalinks   = get_option( 'woocommerce_permalinks' );
                                    $shop_page_id = wc_get_page_id( 'shop' );
                                
                                
                                Severity: Minor
                                Found in includes/wc-update-functions.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 wc_update_330_image_options has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function wc_update_330_image_options() {
                                    $old_thumbnail_size = get_option( 'shop_catalog_image_size', array() );
                                    $old_single_size    = get_option( 'shop_single_image_size', array() );
                                
                                    if ( ! empty( $old_thumbnail_size['width'] ) ) {
                                Severity: Minor
                                Found in includes/wc-update-functions.php - About 1 hr to fix

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

                                  function wc_update_370_mro_std_currency() {
                                      global $wpdb;
                                  
                                      // Fix currency settings for MRU and STN currency.
                                      $current_currency = get_option( 'woocommerce_currency' );
                                  Severity: Minor
                                  Found in includes/wc-update-functions.php - About 1 hr to fix

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

                                    function wc_update_200_permalinks() {
                                        // Setup default permalinks if shop page is defined.
                                        $permalinks   = get_option( 'woocommerce_permalinks' );
                                        $shop_page_id = wc_get_page_id( 'shop' );
                                    
                                    
                                    Severity: Minor
                                    Found in includes/wc-update-functions.php - About 1 hr to fix

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

                                      function wc_update_330_webhooks() {
                                          register_post_type( 'shop_webhook' );
                                      
                                          // Map statuses from post_type to Webhooks CRUD.
                                          $statuses = array(
                                      Severity: Minor
                                      Found in includes/wc-update-functions.php - About 1 hr to fix

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

                                        function wc_update_330_product_stock_status() {
                                            global $wpdb;
                                        
                                            if ( 'yes' !== get_option( 'woocommerce_manage_stock' ) ) {
                                                return;
                                        Severity: Minor
                                        Found in includes/wc-update-functions.php - About 1 hr to fix

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

                                          function wc_update_210_file_paths() {
                                              global $wpdb;
                                          
                                              // Upgrade file paths to support multiple file paths + names etc.
                                              $existing_file_paths = $wpdb->get_results( "SELECT meta_value, meta_id FROM {$wpdb->postmeta} WHERE meta_key = '_file_paths' AND meta_value != '';" );
                                          Severity: Minor
                                          Found in includes/wc-update-functions.php - About 1 hr to fix

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

                                            function wc_update_340_state() {
                                                global $wpdb;
                                            
                                                $country_states = array_filter( (array) get_option( 'woocommerce_update_340_states', array() ) );
                                            
                                            
                                            Severity: Minor
                                            Found in includes/wc-update-functions.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 wc_update_300_product_visibility has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function wc_update_300_product_visibility() {
                                                global $wpdb;
                                            
                                                WC_Install::create_terms();
                                            
                                            
                                            Severity: Minor
                                            Found in includes/wc-update-functions.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 wc_update_200_subcat_display has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function wc_update_200_subcat_display() {
                                                // Update subcat display settings.
                                                if ( 'yes' === get_option( 'woocommerce_shop_show_subcategories' ) ) {
                                                    if ( 'yes' === get_option( 'woocommerce_hide_products_when_showing_subcategories' ) ) {
                                                        update_option( 'woocommerce_shop_page_display', 'subcategories' );
                                            Severity: Minor
                                            Found in includes/wc-update-functions.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 wc_update_370_tax_rate_classes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function wc_update_370_tax_rate_classes() {
                                                global $wpdb;
                                            
                                                $classes = array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) );
                                            
                                            
                                            Severity: Minor
                                            Found in includes/wc-update-functions.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 wc_update_330_set_paypal_sandbox_credentials has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function wc_update_330_set_paypal_sandbox_credentials() {
                                            
                                                $paypal_settings = get_option( 'woocommerce_paypal_settings' );
                                            
                                                if ( isset( $paypal_settings['testmode'] ) && 'yes' === $paypal_settings['testmode'] ) {
                                            Severity: Minor
                                            Found in includes/wc-update-functions.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 wc_update_220_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function wc_update_220_attributes() {
                                                global $wpdb;
                                                // Update taxonomy names with correct sanitized names.
                                                $attribute_taxonomies = $wpdb->get_results( 'SELECT attribute_name, attribute_id FROM ' . $wpdb->prefix . 'woocommerce_attribute_taxonomies' );
                                            
                                            
                                            Severity: Minor
                                            Found in includes/wc-update-functions.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 wc_update_200_file_paths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function wc_update_200_file_paths() {
                                                global $wpdb;
                                            
                                                // Upgrade old style files paths to support multiple file paths.
                                                $existing_file_paths = $wpdb->get_results( "SELECT meta_value, meta_id, post_id FROM {$wpdb->postmeta} WHERE meta_key = '_file_path' AND meta_value != '';" );
                                            Severity: Minor
                                            Found in includes/wc-update-functions.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 wc_update_240_api_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function wc_update_240_api_keys() {
                                                global $wpdb;
                                                /**
                                                 * Update the old user API keys to the new Apps keys.
                                                 */
                                            Severity: Minor
                                            Found in includes/wc-update-functions.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 wc_update_450_sanitize_coupons_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function wc_update_450_sanitize_coupons_code() {
                                                global $wpdb;
                                            
                                                $coupon_id      = 0;
                                                $last_coupon_id = get_option( 'woocommerce_update_450_last_coupon_id', '0' );
                                            Severity: Minor
                                            Found in includes/wc-update-functions.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

                                                $mx_states = array(
                                                    'Distrito Federal'    => 'CMX',
                                                    'Jalisco'             => 'JAL',
                                                    'Nuevo Leon'          => 'NLE',
                                                    'Aguascalientes'      => 'AGS',
                                            Severity: Major
                                            Found in includes/wc-update-functions.php and 1 other location - About 4 hrs to fix
                                            includes/data-stores/class-wc-product-data-store-cpt.php on lines 329..362

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

                                            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