skyverge/wc-plugin-framework

View on GitHub

Showing 396 of 396 total issues

File class-sv-wc-payment-gateway.php has 1556 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WooCommerce Payment Gateway Framework
 *
 * This source file is subject to the GNU General Public License v3.0
Severity: Major
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway.php - About 4 days to fix

    SV_WC_Payment_Gateway has 170 functions (exceeds 20 allowed). Consider refactoring.
    Open

    #[\AllowDynamicProperties]
    abstract class SV_WC_Payment_Gateway extends \WC_Payment_Gateway {
    
    
        /** Sends through sale and request for funds to be charged to cardholder's credit card. */
    Severity: Major
    Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway.php - About 3 days to fix

      Function get_tokens has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get_tokens( $user_id, $args = array() ) {
      
              // default to current environment
              if ( ! isset( $args['environment_id'] ) ) {
                  $args['environment_id'] = $this->get_environment_id();

      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

      SV_WC_Plugin has 71 functions (exceeds 20 allowed). Consider refactoring.
      Open

      #[\AllowDynamicProperties]
      abstract class SV_WC_Plugin {
      
      
          /** Plugin Framework Version */
      Severity: Major
      Found in woocommerce/class-sv-wc-plugin.php - About 1 day to fix

        File class-sv-wc-payment-gateway-direct.php has 579 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * WooCommerce Payment Gateway Framework
         *
         * This source file is subject to the GNU General Public License v3.0
        Severity: Major
        Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php - About 1 day to fix

          File class-sv-wc-payment-gateway-plugin.php has 568 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * WooCommerce Payment Gateway Framework
           *
           * This source file is subject to the GNU General Public License v3.0
          Severity: Major
          Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php - About 1 day to fix

            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

              SV_WC_Payment_Gateway_Plugin has 63 functions (exceeds 20 allowed). Consider refactoring.
              Open

              #[\AllowDynamicProperties]
              abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
              
              
                  /** Customer ID feature */
              Severity: Major
              Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php - About 1 day to fix

                File class-sv-wc-payment-gateway-payment-tokens-handler.php has 490 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * WooCommerce Payment Gateway Framework
                 *
                 * This source file is subject to the GNU General Public License v3.0

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if ( static::is_cart_block_in_use() ) {
                  
                              if ( ! $this->is_cart_block_compatible() ) {
                  
                                  $url = get_edit_post_link( wc_get_page_id( 'cart' ) );
                  Severity: Major
                  Found in woocommerce/Blocks/Blocks_Handler.php and 1 other location - About 7 hrs to fix
                  woocommerce/Blocks/Blocks_Handler.php on lines 266..295

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 240.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if ( static::is_checkout_block_in_use() ) {
                  
                              if ( ! $this->is_checkout_block_compatible() ) {
                  
                                  $url = get_edit_post_link( wc_get_page_id( 'checkout' ) );
                  Severity: Major
                  Found in woocommerce/Blocks/Blocks_Handler.php and 1 other location - About 7 hrs to fix
                  woocommerce/Blocks/Blocks_Handler.php on lines 297..326

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 240.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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 add_transaction_data has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function add_transaction_data( $order, $response = null ) {
                    
                            // transaction id if available
                            if ( $response && $response->get_transaction_id() ) {
                    
                    
                    Severity: Minor
                    Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway.php - About 6 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-sv-wc-plugin.php has 440 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: Minor
                    Found in woocommerce/class-sv-wc-plugin.php - About 6 hrs to fix

                      File Country_Helper.php has 436 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: Minor
                      Found in woocommerce/Country_Helper.php - About 6 hrs to fix

                        SV_WC_Payment_Gateway_My_Payment_Methods has 46 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        #[\AllowDynamicProperties]
                        class SV_WC_Payment_Gateway_My_Payment_Methods extends Handlers\Script_Handler {
                        
                        
                            /** @var SV_WC_Payment_Gateway_Plugin */

                          File class-sv-wc-helper.php has 427 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: Minor
                          Found in woocommerce/class-sv-wc-helper.php - About 6 hrs to fix

                            File class-sv-wc-payment-gateway-payment-form.php has 413 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            /**
                             * WooCommerce Payment Gateway Framework
                             *
                             * This source file is subject to the GNU General Public License v3.0

                              SV_WC_API_Base has 42 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              #[\AllowDynamicProperties]
                              abstract class SV_WC_API_Base {
                              
                              
                                  /** @var string request method, defaults to POST */
                              Severity: Minor
                              Found in woocommerce/api/class-sv-wc-api-base.php - About 5 hrs to fix

                                File class-sv-wp-background-job-handler.php has 401 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: Minor
                                Found in woocommerce/utilities/class-sv-wp-background-job-handler.php - About 5 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language