woothemes/woocommerce

View on GitHub

Showing 4,341 of 4,341 total issues

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

S2.define('select2/selection/allowClear',[
  'jquery',
  '../keys'
], function ($, KEYS) {
  function AllowClear () { }
Severity: Major
Found in assets/js/select2/select2.js and 3 other locations - About 3 days to fix
assets/js/select2/select2.full.js on lines 1729..1825
assets/js/selectWoo/selectWoo.full.js on lines 1824..1920
assets/js/selectWoo/selectWoo.js on lines 1824..1920

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

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

S2.define('select2/selection/allowClear',[
  'jquery',
  '../keys'
], function ($, KEYS) {
  function AllowClear () { }
Severity: Major
Found in assets/js/selectWoo/selectWoo.full.js and 3 other locations - About 3 days to fix
assets/js/select2/select2.full.js on lines 1729..1825
assets/js/select2/select2.js on lines 1729..1825
assets/js/selectWoo/selectWoo.js on lines 1824..1920

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

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

S2.define('select2/selection/allowClear',[
  'jquery',
  '../keys'
], function ($, KEYS) {
  function AllowClear () { }
Severity: Major
Found in assets/js/select2/select2.full.js and 3 other locations - About 3 days to fix
assets/js/select2/select2.js on lines 1729..1825
assets/js/selectWoo/selectWoo.full.js on lines 1824..1920
assets/js/selectWoo/selectWoo.js on lines 1824..1920

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

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

    'JP' => array(
        'JP01' => __( 'Hokkaido', 'woocommerce' ),
        'JP02' => __( 'Aomori', 'woocommerce' ),
        'JP03' => __( 'Iwate', 'woocommerce' ),
        'JP04' => __( 'Miyagi', 'woocommerce' ),
Severity: Major
Found in i18n/states.php and 1 other location - About 3 days to fix
i18n/states.php on lines 886..934

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

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

    'KE' => array( // Kenya counties.
        'KE01' => __( 'Baringo', 'woocommerce' ),
        'KE02' => __( 'Bomet', 'woocommerce' ),
        'KE03' => __( 'Bungoma', 'woocommerce' ),
        'KE04' => __( 'Busia', 'woocommerce' ),
Severity: Major
Found in i18n/states.php and 1 other location - About 3 days to fix
i18n/states.php on lines 837..885

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

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

File class-wc-api-products.php has 1435 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WooCommerce API Products Class
 *
 * Handles requests to the /products endpoint
Severity: Major
Found in includes/legacy/api/v2/class-wc-api-products.php - About 3 days to fix

    File class-wc-rest-orders-v2-controller.php has 1434 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * REST API Orders controller
     *
     * Handles requests to the /orders endpoint.

      File jquery.zeroclipboard.js has 1417 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * jquery.zeroclipboard
       * Bind to the `beforecopy`, `copy`, `aftercopy`, and `copy-error` events, custom DOM-like events for clipboard injection generated using jQuery's Special Events API and ZeroClipboard's Core module.
       * Copyright (c) 2014 
       * Licensed MIT
      Severity: Major
      Found in assets/js/zeroclipboard/jquery.zeroclipboard.js - About 3 days to fix

        File class-wc-product-data-store-cpt.php has 1385 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * WC_Product_Data_Store_CPT class file.
         *
         * @package WooCommerce\Classes
        Severity: Major
        Found in includes/data-stores/class-wc-product-data-store-cpt.php - About 3 days to fix

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

          S2.define('select2/data/array',[
            './select',
            '../utils',
            'jquery'
          ], function (SelectAdapter, Utils, $) {
          Severity: Major
          Found in assets/js/select2/select2.js and 3 other locations - About 3 days to fix
          assets/js/select2/select2.full.js on lines 3308..3386
          assets/js/selectWoo/selectWoo.full.js on lines 3416..3494
          assets/js/selectWoo/selectWoo.js on lines 3416..3494

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

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

          S2.define('select2/data/array',[
            './select',
            '../utils',
            'jquery'
          ], function (SelectAdapter, Utils, $) {
          Severity: Major
          Found in assets/js/selectWoo/selectWoo.js and 3 other locations - About 3 days to fix
          assets/js/select2/select2.full.js on lines 3308..3386
          assets/js/select2/select2.js on lines 3308..3386
          assets/js/selectWoo/selectWoo.full.js on lines 3416..3494

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

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

          S2.define('select2/data/array',[
            './select',
            '../utils',
            'jquery'
          ], function (SelectAdapter, Utils, $) {
          Severity: Major
          Found in assets/js/select2/select2.full.js and 3 other locations - About 3 days to fix
          assets/js/select2/select2.js on lines 3308..3386
          assets/js/selectWoo/selectWoo.full.js on lines 3416..3494
          assets/js/selectWoo/selectWoo.js on lines 3416..3494

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

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

          S2.define('select2/data/array',[
            './select',
            '../utils',
            'jquery'
          ], function (SelectAdapter, Utils, $) {
          Severity: Major
          Found in assets/js/selectWoo/selectWoo.full.js and 3 other locations - About 3 days to fix
          assets/js/select2/select2.full.js on lines 3308..3386
          assets/js/select2/select2.js on lines 3308..3386
          assets/js/selectWoo/selectWoo.js on lines 3416..3494

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

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

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

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

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

          Refactorings

          Further Reading

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

              protected function merge_query_args( $base_args, $request_args ) {
          
                  $args = array();
          
                  // date
          Severity: Major
          Found in includes/legacy/api/v2/class-wc-api-resource.php and 1 other location - About 3 days to fix
          includes/legacy/api/v3/class-wc-api-resource.php on lines 150..234

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

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

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

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

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

          Refactorings

          Further Reading

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

              protected function merge_query_args( $base_args, $request_args ) {
          
                  $args = array();
          
                  // date
          Severity: Major
          Found in includes/legacy/api/v3/class-wc-api-resource.php and 1 other location - About 3 days to fix
          includes/legacy/api/v2/class-wc-api-resource.php on lines 148..232

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

          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 ( isset( $data['attributes'] ) ) {
                      $attributes = array();
          
                      foreach ( $data['attributes'] as $attribute ) {
                          $is_taxonomy = 0;
          Severity: Major
          Found in includes/legacy/api/v2/class-wc-api-products.php and 1 other location - About 3 days to fix
          includes/legacy/api/v3/class-wc-api-products.php on lines 1445..1525

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

          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 ( isset( $data['attributes'] ) ) {
                      $attributes = array();
          
                      foreach ( $data['attributes'] as $attribute ) {
                          $is_taxonomy = 0;
          Severity: Major
          Found in includes/legacy/api/v3/class-wc-api-products.php and 1 other location - About 3 days to fix
          includes/legacy/api/v2/class-wc-api-products.php on lines 960..1040

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

          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

              public function get_order_refund( $order_id, $id, $fields = null, $filter = array() ) {
                  try {
                      // Validate order ID
                      $order_id = $this->validate_request( $order_id, $this->post_type, 'read' );
          
          
          Severity: Major
          Found in includes/legacy/api/v3/class-wc-api-orders.php and 1 other location - About 3 days to fix
          includes/legacy/api/v2/class-wc-api-orders.php on lines 1500..1565

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

          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

              public function get_order_refund( $order_id, $id, $fields = null, $filter = array() ) {
                  try {
                      // Validate order ID
                      $order_id = $this->validate_request( $order_id, $this->post_type, 'read' );
          
          
          Severity: Major
          Found in includes/legacy/api/v2/class-wc-api-orders.php and 1 other location - About 3 days to fix
          includes/legacy/api/v3/class-wc-api-orders.php on lines 1545..1610

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

          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

          Method get_item_schema has 675 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function get_item_schema() {
                  $schema = array(
                      '$schema'    => 'http://json-schema.org/draft-04/schema#',
                      'title'      => $this->post_type,
                      'type'       => 'object',
            Severity
            Category
            Status
            Source
            Language