woocommerce/woocommerce

View on GitHub
includes/class-woocommerce.php

Summary

Maintainability
D
2 days
Test Coverage

File class-woocommerce.php has 473 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WooCommerce setup
 *
 * @package WooCommerce
Severity: Minor
Found in includes/class-woocommerce.php - About 7 hrs to fix

    WooCommerce has 45 functions (exceeds 20 allowed). Consider refactoring.
    Open

    final class WooCommerce {
    
        /**
         * WooCommerce version.
         *
    Severity: Minor
    Found in includes/class-woocommerce.php - About 6 hrs to fix

      Method includes has 122 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function includes() {
              /**
               * Class autoloader.
               */
              include_once WC_ABSPATH . 'includes/class-wc-autoloader.php';
      Severity: Major
      Found in includes/class-woocommerce.php - About 4 hrs to fix

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

            private function theme_support_includes() {
                if ( wc_is_wp_default_theme_active() ) {
                    switch ( get_template() ) {
                        case 'twentyten':
                            include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-ten.php';
        Severity: Minor
        Found in includes/class-woocommerce.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 theme_support_includes has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function theme_support_includes() {
                if ( wc_is_wp_default_theme_active() ) {
                    switch ( get_template() ) {
                        case 'twentyten':
                            include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-ten.php';
        Severity: Minor
        Found in includes/class-woocommerce.php - About 1 hr to fix

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

              public function api_request_url( $request, $ssl = null ) {
                  if ( is_null( $ssl ) ) {
                      $scheme = wp_parse_url( home_url(), PHP_URL_SCHEME );
                  } elseif ( $ssl ) {
                      $scheme = 'https';
          Severity: Minor
          Found in includes/class-woocommerce.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