woothemes/woocommerce

View on GitHub
includes/admin/class-wc-admin-status.php

Summary

Maintainability
D
2 days
Test Coverage

Function output_plugins_info has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private static function output_plugins_info( $plugins, $untested_plugins ) {
        $wc_version = Constants::get_constant( 'WC_VERSION' );

        if ( 'major' === Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' ) ) {
            // Since we're only testing against major, we don't need to show minor and patch version.
Severity: Minor
Found in includes/admin/class-wc-admin-status.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

Function get_latest_theme_version has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get_latest_theme_version( $theme ) {
        include_once ABSPATH . 'wp-admin/includes/theme.php';

        $api = themes_api(
            'theme_information',
Severity: Minor
Found in includes/admin/class-wc-admin-status.php - About 2 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

File class-wc-admin-status.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Debug/Status page
 *
 * @package WooCommerce\Admin\System Status
Severity: Minor
Found in includes/admin/class-wc-admin-status.php - About 2 hrs to fix

    Function scan_template_files has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function scan_template_files( $template_path ) {
            $files  = @scandir( $template_path ); // @codingStandardsIgnoreLine.
            $result = array();
    
            if ( ! empty( $files ) ) {
    Severity: Minor
    Found in includes/admin/class-wc-admin-status.php - About 2 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_latest_theme_version has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function get_latest_theme_version( $theme ) {
            include_once ABSPATH . 'wp-admin/includes/theme.php';
    
            $api = themes_api(
                'theme_information',
    Severity: Minor
    Found in includes/admin/class-wc-admin-status.php - About 1 hr to fix

      Method output_plugins_info has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function output_plugins_info( $plugins, $untested_plugins ) {
              $wc_version = Constants::get_constant( 'WC_VERSION' );
      
              if ( 'major' === Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' ) ) {
                  // Since we're only testing against major, we don't need to show minor and patch version.
      Severity: Minor
      Found in includes/admin/class-wc-admin-status.php - About 1 hr to fix

        Method status_tools has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function status_tools() {
                if ( ! class_exists( 'WC_REST_System_Status_Tools_Controller' ) ) {
                    wp_die( 'Cannot load the REST API to access WC_REST_System_Status_Tools_Controller.' );
                }
        
        
        Severity: Minor
        Found in includes/admin/class-wc-admin-status.php - About 1 hr to fix

          Function status_tools has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function status_tools() {
                  if ( ! class_exists( 'WC_REST_System_Status_Tools_Controller' ) ) {
                      wp_die( 'Cannot load the REST API to access WC_REST_System_Status_Tools_Controller.' );
                  }
          
          
          Severity: Minor
          Found in includes/admin/class-wc-admin-status.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

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

              private static function log_table_bulk_actions() {
                  if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-status-logs' ) ) { // WPCS: input var ok, sanitization ok.
                      wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
                  }
          
          
          Severity: Minor
          Found in includes/admin/class-wc-admin-status.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