woocommerce/woocommerce

View on GitHub
assets/js/admin/meta-boxes-order.js

Summary

Maintainability
F
2 wks
Test Coverage

File meta-boxes-order.js has 1228 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// eslint-disable-next-line max-len
/*global woocommerce_admin_meta_boxes, woocommerce_admin, accounting, woocommerce_admin_meta_boxes_order, wcSetClipboard, wcClearClipboard */
jQuery( function ( $ ) {

    // Stand-in wcTracks.recordEvent in case tracks is not available (for any reason).
Severity: Major
Found in assets/js/admin/meta-boxes-order.js - About 3 days to fix

    Function do_refund has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                do_refund: function() {
                    wc_meta_boxes_order_items.block();
    
                    if ( window.confirm( woocommerce_admin_meta_boxes.i18n_do_refund ) ) {
                        var refund_amount   = $( 'input#refund_amount' ).val();
    Severity: Major
    Found in assets/js/admin/meta-boxes-order.js - About 2 hrs to fix

      Function change_country has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              change_country: function( e, stickValue ) {
                  // Check for stickValue before using it
                  if ( typeof stickValue === 'undefined' ){
                      stickValue = false;
                  }
      Severity: Major
      Found in assets/js/admin/meta-boxes-order.js - About 2 hrs to fix

        Function quantity_changed has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                quantity_changed: function() {
                    var $row          = $( this ).closest( 'tr.item' );
                    var qty           = $( this ).val();
                    var o_qty         = $( this ).attr( 'data-qty' );
                    var line_total    = $( 'input.line_total', $row );
        Severity: Minor
        Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

          Function add_coupon has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  add_coupon: function() {
                      window.wcTracks.recordEvent( 'order_edit_add_coupon_click', {
                          order_id: woocommerce_admin_meta_boxes.post_id,
                          status: $( '#order_status' ).val()
                      } );
          Severity: Minor
          Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

            Function refund_quantity_changed has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        refund_quantity_changed: function() {
                            var $row              = $( this ).closest( 'tr.item' );
                            var qty               = $row.find( 'input.quantity' ).val();
                            var refund_qty        = $( this ).val();
                            var line_total        = $( 'input.line_total', $row );
            Severity: Minor
            Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

              Function delete_item has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      delete_item: function() {
                          var answer = window.confirm( woocommerce_admin_meta_boxes.remove_item_notice );
              
                          if ( answer ) {
                              var $item         = $( this ).closest( 'tr.item, tr.fee, tr.shipping' );
              Severity: Minor
              Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                Function add_tax has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            add_tax: function( rate_id, manual_rate_id ) {
                                if ( manual_rate_id ) {
                                    rate_id = manual_rate_id;
                                }
                
                
                Severity: Minor
                Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                  Function init has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          init: function() {
                              this.stupidtable.init();
                  
                              $( '#woocommerce-order-items' )
                                  .on( 'click', 'button.add-line-item', this.add_line_item )
                  Severity: Minor
                  Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                    Function delete_tax has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            delete_tax: function() {
                                if ( window.confirm( woocommerce_admin_meta_boxes.i18n_delete_tax ) ) {
                                    wc_meta_boxes_order_items.block();
                    
                                    var data = {
                    Severity: Minor
                    Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                      Function recalculate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              recalculate: function() {
                                  if ( window.confirm( woocommerce_admin_meta_boxes.calc_totals ) ) {
                                      wc_meta_boxes_order_items.block();
                      
                                      var data = $.extend( {}, wc_meta_boxes_order_items.get_taxable_address(), {
                      Severity: Minor
                      Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                        Function add_items has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    add_items: function( add_items ) {
                                        wc_meta_boxes_order_items.block();
                        
                                        var data = {
                                            action   : 'woocommerce_add_order_item',
                        Severity: Minor
                        Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                          Function add_fee has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  add_fee: function() {
                                      window.wcTracks.recordEvent( 'order_edit_add_fee_click', {
                                          order_id: woocommerce_admin_meta_boxes.post_id,
                                          status: $( '#order_status' ).val()
                                      } );
                          Severity: Minor
                          Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                            Function save_line_items has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    save_line_items: function() {
                                        var data = {
                                            order_id: woocommerce_admin_meta_boxes.post_id,
                                            items:    $( 'table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]' ).serialize(),
                                            action:   'woocommerce_save_order_items',
                            Severity: Minor
                            Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                              Function load_shipping has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      load_shipping: function( force ) {
                                          if ( true === force || window.confirm( woocommerce_admin_meta_boxes.load_shipping ) ) {
                              
                                              // Get user ID to load data for
                                              var user_id = $( '#customer_user' ).val();
                              Severity: Minor
                              Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                                Function load_billing has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        load_billing: function( force ) {
                                            if ( true === force || window.confirm( woocommerce_admin_meta_boxes.load_billing ) ) {
                                
                                                // Get user ID to load data for
                                                var user_id = $( '#customer_user' ).val();
                                Severity: Minor
                                Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                                  Function revoke_access has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          revoke_access: function () {
                                              if ( window.confirm( woocommerce_admin_meta_boxes.i18n_permission_revoke ) ) {
                                                  var el            = $( this ).parent().parent();
                                                  var product       = $( this ).attr( 'rel' ).split( ',' )[0];
                                                  var file          = $( this ).attr( 'rel' ).split( ',' )[1];
                                  Severity: Minor
                                  Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                                    Function add_order_note has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            add_order_note: function() {
                                                if ( ! $( 'textarea#add_order_note' ).val() ) {
                                                    return;
                                                }
                                    
                                    
                                    Severity: Minor
                                    Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

                                      Function grant_access has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              grant_access: function() {
                                                  var products = $( '#grant_access_id' ).val();
                                      
                                                  if ( ! products ) {
                                                      return;
                                      Severity: Minor
                                      Found in assets/js/admin/meta-boxes-order.js - About 1 hr to fix

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

                                                load_shipping: function( force ) {
                                                    if ( true === force || window.confirm( woocommerce_admin_meta_boxes.load_shipping ) ) {
                                        
                                                        // Get user ID to load data for
                                                        var user_id = $( '#customer_user' ).val();
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 day to fix
                                        assets/js/admin/meta-boxes-order.js on lines 167..207

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

                                        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

                                                load_billing: function( force ) {
                                                    if ( true === force || window.confirm( woocommerce_admin_meta_boxes.load_billing ) ) {
                                        
                                                        // Get user ID to load data for
                                                        var user_id = $( '#customer_user' ).val();
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 day to fix
                                        assets/js/admin/meta-boxes-order.js on lines 209..249

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

                                        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

                                                        $.ajax( {
                                                            url:     woocommerce_admin_meta_boxes.ajax_url,
                                                            data:    data,
                                                            type:    'POST',
                                                            success: function( response ) {
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 day to fix
                                        assets/js/admin/meta-boxes-order.js on lines 720..741

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

                                        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

                                                        $.ajax({
                                                            url:  woocommerce_admin_meta_boxes.ajax_url,
                                                            data: data,
                                                            type: 'POST',
                                                            success: function( response ) {
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 day to fix
                                        assets/js/admin/meta-boxes-order.js on lines 465..486

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

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

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

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

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

                                        Refactorings

                                        Further Reading

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

                                                            success: function( response ) {
                                                                if ( response.success ) {
                                                                    $( '#woocommerce-order-items' ).find( '.inside' ).empty();
                                                                    $( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html );
                                        
                                        
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 day to fix
                                        assets/js/admin/meta-boxes-order.js on lines 839..856

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

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

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

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

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

                                        Refactorings

                                        Further Reading

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

                                                        success: function( response ) {
                                                            if ( response.success ) {
                                                                $( '#woocommerce-order-items' ).find( '.inside' ).empty();
                                                                $( '#woocommerce-order-items' ).find( '.inside' ).append( response.data.html );
                                        
                                        
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 day to fix
                                        assets/js/admin/meta-boxes-order.js on lines 1189..1206

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

                                        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

                                                change_state: function() {
                                                    // Here we will find if state value on a select has changed and stick it to the country data
                                                    var $this = $( this ),
                                                        state = $this.val(),
                                                        $country = $this.parents( 'div.edit_address' ).find( ':input.js_field-country' ),
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 2 hrs to fix
                                        assets/js/admin/users.js on lines 90..98

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

                                        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

                                                    $( '#woocommerce-order-items' )
                                                        .on( 'click', 'button.add-line-item', this.add_line_item )
                                                        .on( 'click', 'button.add-coupon', this.add_coupon )
                                                        .on( 'click', 'a.remove-coupon', this.remove_coupon )
                                                        .on( 'click', 'button.refund-items', this.refund_items )
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 2 hrs to fix
                                        assets/js/admin/meta-boxes-product-variation.js on lines 14..20

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

                                        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

                                                    if ( 'billing' === woocommerce_admin_meta_boxes.tax_based_on || ! country ) {
                                                        country  = $( '#_billing_country' ).val();
                                                        state    = $( '#_billing_state' ).val();
                                                        postcode = $( '#_billing_postcode' ).val();
                                                        city     = $( '#_billing_city' ).val();
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 2 hrs to fix
                                        assets/js/admin/meta-boxes-order.js on lines 757..762

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

                                        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

                                                    if ( 'shipping' === woocommerce_admin_meta_boxes.tax_based_on ) {
                                                        country  = $( '#_shipping_country' ).val();
                                                        state    = $( '#_shipping_state' ).val();
                                                        postcode = $( '#_shipping_postcode' ).val();
                                                        city     = $( '#_shipping_city' ).val();
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 2 hrs to fix
                                        assets/js/admin/meta-boxes-order.js on lines 764..769

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

                                        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 3 locations. Consider refactoring.
                                        Open

                                                        $( 'button .wc-order-refund-amount .amount' ).text( accounting.formatMoney( total, {
                                                            symbol:    woocommerce_admin_meta_boxes.currency_format_symbol,
                                                            decimal:   woocommerce_admin_meta_boxes.currency_format_decimal_sep,
                                                            thousand:  woocommerce_admin_meta_boxes.currency_format_thousand_sep,
                                                            precision: woocommerce_admin_meta_boxes.currency_format_num_decimals,
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 2 other locations - About 1 hr to fix
                                        assets/js/frontend/price-slider.js on lines 11..17
                                        assets/js/frontend/price-slider.js on lines 19..25

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

                                        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

                                                    if ( ! $.isEmptyObject( wc_meta_boxes_order.states[ country ] ) ) {
                                                        var state = wc_meta_boxes_order.states[ country ],
                                                            $defaultOption = $( '<option value=""></option>' )
                                                                .text( woocommerce_admin_meta_boxes_order.i18n_select_state_text );
                                        
                                        
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 hr to fix
                                        assets/js/admin/users.js on lines 51..83

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

                                        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

                                                        if ( 0 < unit_total_tax ) {
                                                            $line_total_tax.val(
                                                                parseFloat( accounting.formatNumber( unit_total_tax * qty, precision, '' ) )
                                                                    .toString()
                                                                    .replace( '.', woocommerce_admin.mon_decimal_point )
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 hr to fix
                                        assets/js/admin/meta-boxes-order.js on lines 412..418

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

                                        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

                                                copy_success: function() {
                                                    $( this ).tipTip({
                                                        'attribute':  'data-tip',
                                                        'activation': 'focus',
                                                        'fadeIn':     50,
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 hr to fix
                                        assets/js/admin/meta-boxes-order.js on lines 1479..1487

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

                                        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

                                                copy_fail: function() {
                                                    $( this ).tipTip({
                                                        'attribute':  'data-tip-failed',
                                                        'activation': 'focus',
                                                        'fadeIn':     50,
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 hr to fix
                                        assets/js/admin/meta-boxes-order.js on lines 1466..1474

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

                                        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

                                                        if ( 0 < unit_subtotal_tax ) {
                                                            $line_subtotal_tax.val(
                                                                parseFloat( accounting.formatNumber( unit_subtotal_tax * qty, precision, '' ) )
                                                                    .toString()
                                                                    .replace( '.', woocommerce_admin.mon_decimal_point )
                                        Severity: Major
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 1 hr to fix
                                        assets/js/admin/meta-boxes-order.js on lines 404..410

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

                                        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

                                                    line_subtotal.val(
                                                        parseFloat( accounting.formatNumber( unit_subtotal * qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) )
                                                            .toString()
                                                            .replace( '.', woocommerce_admin.mon_decimal_point )
                                                    );
                                        Severity: Minor
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 50 mins to fix
                                        assets/js/admin/meta-boxes-order.js on lines 373..377

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

                                        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

                                                    line_total.val(
                                                        parseFloat( accounting.formatNumber( unit_total * qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) )
                                                            .toString()
                                                            .replace( '.', woocommerce_admin.mon_decimal_point )
                                                    );
                                        Severity: Minor
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 50 mins to fix
                                        assets/js/admin/meta-boxes-order.js on lines 380..384

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

                                        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

                                                block: function() {
                                                    $( '#woocommerce-order-items' ).block({
                                                        message: null,
                                                        overlayCSS: {
                                                            background: '#fff',
                                        Severity: Minor
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 35 mins to fix
                                        assets/js/admin/settings-views-html-settings-tax.js on lines 67..75

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

                                        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

                                                        if ( 'true' === $( 'button.cancel-action' ).attr( 'data-reload' ) ) {
                                                            data.items = $( 'table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]' ).serialize();
                                                        }
                                        Severity: Minor
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 35 mins to fix
                                        assets/js/admin/meta-boxes-order.js on lines 672..674

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

                                        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

                                                        if ( 'true' === $( 'button.cancel-action' ).attr( 'data-reload' ) ) {
                                                            data.items = $( 'table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]' ).serialize();
                                                        }
                                        Severity: Minor
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 35 mins to fix
                                        assets/js/admin/meta-boxes-order.js on lines 1181..1183

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

                                        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

                                                                window.wcTracks.recordEvent( 'order_edit_recalc_totals', {
                                                                    order_id: data.post_id,
                                                                    OK_cancel: 'OK',
                                                                    status: $( '#order_status' ).val()
                                                                } );
                                        Severity: Minor
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 35 mins to fix
                                        assets/js/admin/meta-boxes-order.js on lines 815..819

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

                                        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

                                                        window.wcTracks.recordEvent( 'order_edit_recalc_totals', {
                                                            order_id: woocommerce_admin_meta_boxes.post_id,
                                                            OK_cancel: 'cancel',
                                                            status: $( '#order_status' ).val()
                                                        } );
                                        Severity: Minor
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 35 mins to fix
                                        assets/js/admin/meta-boxes-order.js on lines 807..811

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

                                        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

                                                    if ( null == value ) {
                                                        window.wcTracks.recordEvent( 'order_edit_add_coupon_cancel', {
                                                            order_id: woocommerce_admin_meta_boxes.post_id,
                                                            status: $( '#order_status' ).val()
                                                        } );
                                        Severity: Minor
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 35 mins to fix
                                        assets/js/admin/meta-boxes-order.js on lines 574..605

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

                                        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

                                                    if ( null == value ) {
                                                        window.wcTracks.recordEvent( 'order_edit_add_fee_cancel', {
                                                            order_id: woocommerce_admin_meta_boxes.post_id,
                                                            status: $( '#order_status' ).val()
                                                        } );
                                        Severity: Minor
                                        Found in assets/js/admin/meta-boxes-order.js and 1 other location - About 35 mins to fix
                                        assets/js/admin/meta-boxes-order.js on lines 444..487

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

                                        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