woothemes/woocommerce

View on GitHub
includes/class-wc-install.php

Summary

Maintainability
F
1 wk
Test Coverage

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

    Method get_schema has 220 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function get_schema() {
            global $wpdb;
    
            $collate = '';
    
    
    Severity: Major
    Found in includes/class-wc-install.php - About 1 day to fix

      WC_Install has 43 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class WC_Install {
      
          /**
           * DB updates and callbacks that need to be run per version.
           *
      Severity: Minor
      Found in includes/class-wc-install.php - About 5 hrs to fix

        Function background_installer has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function background_installer( $plugin_to_install_id, $plugin_to_install ) {
                // Explicitly clear the event.
                $args = func_get_args();
        
                if ( ! empty( $plugin_to_install['repo-slug'] ) ) {
        Severity: Minor
        Found in includes/class-wc-install.php - About 4 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 background_installer has 107 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function background_installer( $plugin_to_install_id, $plugin_to_install ) {
                // Explicitly clear the event.
                $args = func_get_args();
        
                if ( ! empty( $plugin_to_install['repo-slug'] ) ) {
        Severity: Major
        Found in includes/class-wc-install.php - About 4 hrs to fix

          Method create_roles has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function create_roles() {
                  global $wp_roles;
          
                  if ( ! class_exists( 'WP_Roles' ) ) {
                      return;
          Severity: Major
          Found in includes/class-wc-install.php - About 2 hrs to fix

            Function create_terms has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function create_terms() {
                    $taxonomies = array(
                        'product_type'       => array(
                            'simple',
                            'grouped',
            Severity: Minor
            Found in includes/class-wc-install.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

            Function create_options has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function create_options() {
                    // Include settings so that we can run through defaults.
                    include_once dirname( __FILE__ ) . '/admin/class-wc-admin-settings.php';
            
                    $settings = WC_Admin_Settings::get_settings_pages();
            Severity: Minor
            Found in includes/class-wc-install.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 create_terms has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function create_terms() {
                    $taxonomies = array(
                        'product_type'       => array(
                            'simple',
                            'grouped',
            Severity: Minor
            Found in includes/class-wc-install.php - About 1 hr to fix

              Method theme_background_installer has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function theme_background_installer( $theme_slug ) {
                      // Explicitly clear the event.
                      $args = func_get_args();
              
                      if ( ! empty( $theme_slug ) ) {
              Severity: Minor
              Found in includes/class-wc-install.php - About 1 hr to fix

                Method create_tables has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static function create_tables() {
                        global $wpdb;
                
                        $wpdb->hide_errors();
                
                
                Severity: Minor
                Found in includes/class-wc-install.php - About 1 hr to fix

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

                      private static function create_tables() {
                          global $wpdb;
                  
                          $wpdb->hide_errors();
                  
                  
                  Severity: Minor
                  Found in includes/class-wc-install.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 create_files has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function create_files() {
                          // Bypass if filesystem is read-only and/or non-standard upload system is used.
                          if ( apply_filters( 'woocommerce_install_skip_create_files', false ) ) {
                              return;
                          }
                  Severity: Minor
                  Found in includes/class-wc-install.php - About 1 hr to fix

                    Method create_placeholder_image has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function create_placeholder_image() {
                            $placeholder_image = get_option( 'woocommerce_placeholder_image', 0 );
                    
                            // Validate current setting if set. If set, return.
                            if ( ! empty( $placeholder_image ) ) {
                    Severity: Minor
                    Found in includes/class-wc-install.php - About 1 hr to fix

                      Method create_pages has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function create_pages() {
                              include_once dirname( __FILE__ ) . '/admin/wc-admin-functions.php';
                      
                              $pages = apply_filters(
                                  'woocommerce_create_pages',
                      Severity: Minor
                      Found in includes/class-wc-install.php - About 1 hr to fix

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

                            public static function get_core_capabilities() {
                                $capabilities = array();
                        
                                $capabilities['core'] = array(
                                    'manage_woocommerce',
                        Severity: Minor
                        Found in includes/class-wc-install.php - About 1 hr to fix

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

                              public static function theme_background_installer( $theme_slug ) {
                                  // Explicitly clear the event.
                                  $args = func_get_args();
                          
                                  if ( ! empty( $theme_slug ) ) {
                          Severity: Minor
                          Found in includes/class-wc-install.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 verify_base_tables has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function verify_base_tables( $modify_notice = true, $execute = false ) {
                                  require_once ABSPATH . 'wp-admin/includes/upgrade.php';
                          
                                  if ( $execute ) {
                                      self::create_tables();
                          Severity: Minor
                          Found in includes/class-wc-install.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 create_files has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static function create_files() {
                                  // Bypass if filesystem is read-only and/or non-standard upload system is used.
                                  if ( apply_filters( 'woocommerce_install_skip_create_files', false ) ) {
                                      return;
                                  }
                          Severity: Minor
                          Found in includes/class-wc-install.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 create_placeholder_image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static function create_placeholder_image() {
                                  $placeholder_image = get_option( 'woocommerce_placeholder_image', 0 );
                          
                                  // Validate current setting if set. If set, return.
                                  if ( ! empty( $placeholder_image ) ) {
                          Severity: Minor
                          Found in includes/class-wc-install.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static function update() {
                                  $current_db_version = get_option( 'woocommerce_db_version' );
                                  $loop               = 0;
                          
                                  foreach ( self::get_db_update_callbacks() as $version => $update_callbacks ) {
                          Severity: Minor
                          Found in includes/class-wc-install.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