skyverge/wc-plugin-framework

View on GitHub
woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php

Summary

Maintainability
F
4 days
Test Coverage

File abstract-sv-wc-plugin-admin-setup-wizard.php has 559 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WooCommerce Plugin Framework
 *
 * This source file is subject to the GNU General Public License v3.0
Severity: Major
Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 1 day to fix

    Setup_Wizard has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    #[\AllowDynamicProperties]
    abstract class Setup_Wizard {
    
    
        /** the "finish" step ID */
    Severity: Minor
    Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 6 hrs to fix

      Function render_toggle_form_field has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function render_toggle_form_field( $key, $args, $value ) {
      
              $args = wp_parse_args( $args, array(
                  'type'              => 'text',
                  'label'             => '',
      Severity: Minor
      Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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 render_toggle_form_field has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function render_toggle_form_field( $key, $args, $value ) {
      
              $args = wp_parse_args( $args, array(
                  'type'              => 'text',
                  'label'             => '',
      Severity: Major
      Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 2 hrs to fix

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

            protected function render_next_steps() {
        
                $next_steps         = $this->get_next_steps();
                $additional_actions = $this->get_additional_actions();
        
        
        Severity: Minor
        Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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 render_next_steps has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function render_next_steps() {
        
                $next_steps         = $this->get_next_steps();
                $additional_actions = $this->get_additional_actions();
        
        
        Severity: Minor
        Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 1 hr to fix

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

              public function __construct( Framework\SV_WC_Plugin $plugin ) {
          
                  // sanity check for admin and permissions
                  if ( ! is_admin() || ! current_user_can( $this->required_capability ) ) {
                      return;
          Severity: Minor
          Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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 register_step has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function register_step( $id, $name, $view_callback, $save_callback = null ) {
          
                  try {
          
                      // invalid ID
          Severity: Minor
          Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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 render_form_field has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function render_form_field( $key, $args, $value = null ) {
          
                  if ( ! isset( $args['class'] ) ) {
                      $args['class'] = array();
                  } else {
          Severity: Minor
          Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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 render_page has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function render_page() {
          
                  // maybe save and move onto the next step
                  $error_message = Framework\SV_WC_Helper::get_posted_value( 'save_step' ) ? $this->save_step( $this->current_step ) : '';
          
          
          Severity: Minor
          Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 1 hr to fix

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

                protected function load_scripts_styles() {
            
                    $fw_version = $this->get_plugin()->get_assets_version();
                    $wc_version = defined( 'WC_VERSION' ) ? WC_VERSION : WC()->version ?? $fw_version;
            
            
            Severity: Minor
            Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 1 hr to fix

              Function render_content has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function render_content( $error_message = '' ) {
              
                      ?>
                      <div class="wc-setup-content sv-wc-plugin-admin-setup-content <?php echo esc_attr( $this->get_slug() ) . '-content'; ?>">
              
              
              Severity: Minor
              Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 55 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 save_step has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function save_step( $step_id ) {
              
                      $error_message = __( 'Oops! An error occurred, please try again.', 'woocommerce-plugin-framework' );
              
                      try {
              Severity: Minor
              Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 55 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 add_admin_notices has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function add_admin_notices() {
              
                      if ( Framework\SV_WC_Helper::is_current_screen( 'plugins' ) || $this->get_plugin()->is_plugin_settings() ) {
              
                          if ( $this->is_complete() && $this->get_documentation_notice_message() ) {
              Severity: Minor
              Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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

              Consider simplifying this complex logical expression.
              Open

              if ( ! class_exists( '\\SkyVerge\\WooCommerce\\PluginFramework\\v5_12_3\\Admin\\Setup_Wizard' ) ) :
              
              
              /**
               * The plugin Setup Wizard class.
              Severity: Major
              Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.php - About 40 mins to fix

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

                    protected function render_steps() {
                
                        ?>
                        <ol class="wc-setup-steps">
                
                
                Severity: Minor
                Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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 init_setup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function init_setup() {
                
                        // get a step ID from $_GET
                        $current_step   = sanitize_key( Framework\SV_WC_Helper::get_requested_value( 'step' ) );
                        $current_action = sanitize_key( Framework\SV_WC_Helper::get_requested_value( 'action' ) );
                Severity: Minor
                Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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 get_additional_actions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function get_additional_actions() {
                
                        $next_steps = $this->get_next_steps();
                        $actions    = array();
                
                
                Severity: Minor
                Found in woocommerce/admin/abstract-sv-wc-plugin-admin-setup-wizard.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

                There are no issues that match your filters.

                Category
                Status