woocommerce/woocommerce

View on GitHub

Showing 3,141 of 4,341 total issues

File class-wc-countries.php has 1147 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WooCommerce countries
 *
 * @package WooCommerce\l10n
Severity: Major
Found in includes/class-wc-countries.php - About 2 days to fix

    Function prettyPhoto has 585 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        $.fn.prettyPhoto = function(pp_settings) {
            pp_settings = jQuery.extend({
                hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */
                animation_speed: 'fast', /* fast/slow/normal */
                ajaxcallback: function() {},
    Severity: Major
    Found in assets/js/prettyPhoto/jquery.prettyPhoto.js - About 2 days to fix

      File class-wc-install.php has 1141 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Installation related functions and actions.
       *
       * @package WooCommerce\Classes
      Severity: Major
      Found in includes/class-wc-install.php - About 2 days to fix

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

        <?php
        /**
         * WooCommerce API Orders Class
         *
         * Handles requests to the /orders endpoint
        Severity: Major
        Found in includes/legacy/api/v3/class-wc-api-orders.php - About 2 days to fix

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

          <?php
          /**
           * REST API Products controller
           *
           * Handles requests to the /products endpoint.

            Function output_fields has a Cognitive Complexity of 136 (exceeds 5 allowed). Consider refactoring.
            Open

                    public static function output_fields( $options ) {
                        foreach ( $options as $value ) {
                            if ( ! isset( $value['type'] ) ) {
                                continue;
                            }
            Severity: Minor
            Found in includes/admin/class-wc-admin-settings.php - About 2 days to fix

            Cognitive Complexity

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

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

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

            Further reading

            File abstract-wc-order.php has 1085 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * Abstract Order
             *
             * Handles generic order data and database interaction which is extended by both
            Severity: Major
            Found in includes/abstracts/abstract-wc-order.php - About 2 days to fix

              File class-wc-helper.php has 1080 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * WooCommerce Admin Helper
               *
               * @package WooCommerce\Admin\Helper
              Severity: Major
              Found in includes/admin/helper/class-wc-helper.php - About 2 days to fix

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

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

                  Function prepare_object_for_database has a Cognitive Complexity of 132 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function prepare_object_for_database( $request, $creating = false ) {
                          $id = isset( $request['id'] ) ? absint( $request['id'] ) : 0;
                  
                          // Type is the most important part here because we need to be using the correct class and methods.
                          if ( isset( $request['type'] ) ) {

                  Cognitive Complexity

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

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

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

                  Further reading

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

                  <?php
                  /**
                   * REST API WC System Status controller
                   *
                   * Handles requests to the /system_status endpoint.

                    File class-wc-cart.php has 988 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * WooCommerce cart
                     *
                     * The WooCommerce cart class stores cart data and active coupons as well as handling customer sessions and some cart related urls.
                    Severity: Major
                    Found in includes/class-wc-cart.php - About 2 days to fix

                      WC_Order has 126 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class WC_Order extends WC_Abstract_Order {
                      
                          /**
                           * Stores data about status changes so relevant hooks can be fired.
                           *
                      Severity: Major
                      Found in includes/class-wc-order.php - About 2 days to fix

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

                        /*
                         * jQuery FlexSlider v2.7.2
                         * Copyright 2012 WooThemes
                         * Contributing Author: Tyler Smith
                         */
                        Severity: Major
                        Found in assets/js/flexslider/jquery.flexslider.js - About 2 days to fix

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

                          <?php
                          /**
                           * WooCommerce Product Functions
                           *
                           * Functions for product specific things.
                          Severity: Major
                          Found in includes/wc-product-functions.php - About 2 days to fix

                            File class-wc-order.php has 950 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            /**
                             * Regular order
                             *
                             * @package WooCommerce\Classes
                            Severity: Major
                            Found in includes/class-wc-order.php - About 2 days to fix

                              Method get_item_schema has 469 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'      => 'system_status',
                                          'type'       => 'object',

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

                                    function init(plot) {
                                
                                        var canvas = null,
                                            target = null,
                                            maxRadius = null,
                                Severity: Major
                                Found in assets/js/jquery-flot/jquery.flot.pie.js - About 2 days to fix

                                  Function get_order_report_data has a Cognitive Complexity of 114 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function get_order_report_data( $args = array() ) {
                                          global $wpdb;
                                  
                                          $default_args = array(
                                              'data'                => array(),
                                  Severity: Minor
                                  Found in includes/admin/reports/class-wc-admin-report.php - About 2 days to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

                                  File html-admin-page-status-report.php has 921 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  /**
                                   * Admin View: Page - Status Report.
                                   *
                                   * @package WooCommerce
                                  Severity: Major
                                  Found in includes/admin/views/html-admin-page-status-report.php - About 2 days to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language