woocommerce/woocommerce

View on GitHub
includes/admin/list-tables/class-wc-admin-list-table-orders.php

Summary

Maintainability
F
4 days
Test Coverage

File class-wc-admin-list-table-orders.php has 576 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * List tables: orders.
 *
 * @package WooCommerce\Admin
Severity: Major
Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 1 day to fix

    Function get_order_preview_item_html has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function get_order_preview_item_html( $order ) {
            $hidden_order_itemmeta = apply_filters(
                'woocommerce_hidden_order_itemmeta',
                array(
                    '_qty',
    Severity: Minor
    Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method get_order_preview_item_html has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function get_order_preview_item_html( $order ) {
            $hidden_order_itemmeta = apply_filters(
                'woocommerce_hidden_order_itemmeta',
                array(
                    '_qty',
    Severity: Major
    Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 3 hrs to fix

      WC_Admin_List_Table_Orders has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
      
          /**
           * Post type.
           *
      Severity: Minor
      Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 3 hrs to fix

        Method order_preview_template has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function order_preview_template() {
                ?>
                <script type="text/template" id="tmpl-wc-modal-view-order">
                    <div class="wc-backbone-modal wc-order-preview">
                        <div class="wc-backbone-modal-content">
        Severity: Major
        Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 2 hrs to fix

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

              public function handle_bulk_actions( $redirect_to, $action, $ids ) {
                  $ids     = apply_filters( 'woocommerce_bulk_action_ids', array_reverse( array_map( 'absint', $ids ) ), $action, 'order' );
                  $changed = 0;
          
                  if ( 'remove_personal_data' === $action ) {
          Severity: Minor
          Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 1 hr to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              public function handle_bulk_actions( $redirect_to, $action, $ids ) {
                  $ids     = apply_filters( 'woocommerce_bulk_action_ids', array_reverse( array_map( 'absint', $ids ) ), $action, 'order' );
                  $changed = 0;
          
                  if ( 'remove_personal_data' === $action ) {
          Severity: Minor
          Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 1 hr to fix

            Method order_preview_get_order_details has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function order_preview_get_order_details( $order ) {
                    if ( ! $order ) {
                        return array();
                    }
            
            
            Severity: Minor
            Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 1 hr to fix

              Method get_order_preview_actions_html has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function get_order_preview_actions_html( $order ) {
                      $actions        = array();
                      $status_actions = array();
              
                      if ( $order->has_status( array( 'pending' ) ) ) {
              Severity: Minor
              Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 1 hr to fix

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

                    protected function query_filters( $query_vars ) {
                        global $wp_post_statuses;
                
                        // Filter the orders by the posted customer.
                        if ( ! empty( $_GET['_customer_user'] ) ) { // WPCS: input var ok.
                Severity: Minor
                Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

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

                    protected function query_filters( $query_vars ) {
                        global $wp_post_statuses;
                
                        // Filter the orders by the posted customer.
                        if ( ! empty( $_GET['_customer_user'] ) ) { // WPCS: input var ok.
                Severity: Minor
                Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 1 hr to fix

                  Function render_order_status_column has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function render_order_status_column() {
                          $tooltip                 = '';
                          $comment_count           = get_comment_count( $this->object->get_id() );
                          $approved_comments_count = absint( $comment_count['approved'] );
                  
                  
                  Severity: Minor
                  Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 45 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

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

                      public function bulk_admin_notices() {
                          global $post_type, $pagenow;
                  
                          // Bail out if not on shop order list page.
                          if ( 'edit.php' !== $pagenow || 'shop_order' !== $post_type || ! isset( $_REQUEST['bulk_action'] ) ) { // WPCS: input var ok, CSRF ok.
                  Severity: Minor
                  Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 35 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

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

                      protected function render_order_number_column() {
                          $buyer = '';
                  
                          if ( $this->object->get_billing_first_name() || $this->object->get_billing_last_name() ) {
                              /* translators: 1: first name 2: last name */
                  Severity: Minor
                  Found in includes/admin/list-tables/class-wc-admin-list-table-orders.php - About 25 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  There are no issues that match your filters.

                  Category
                  Status