skyverge/wc-plugin-framework

View on GitHub

Showing 376 of 396 total issues

Function validate_fields has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate_fields() {

        $is_valid = parent::validate_fields();

        if ( $this->supports_tokenization() ) {
Severity: Minor
Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.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

Setting has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

#[\AllowDynamicProperties]
class Setting {


    /** @var string the string setting type */
Severity: Minor
Found in woocommerce/Settings_API/Setting.php - About 3 hrs to fix

    Function process_payment has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function process_payment( $payment_data, $product_id ) {
    
            $order = null;
    
            try {

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

        public function perform_capture( \WC_Order $order, $amount = null ) {
    
            $order = $this->get_gateway()->get_order_for_capture( $order, $amount );
    
            try {
    Severity: Minor
    Found in woocommerce/payment-gateway/Handlers/Capture.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_fields has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function get_fields( $type = '' ) {
    
            if ( ! $type ) {
                $type = $this->get_gateway()->get_payment_type();
            }

      Lifecycle has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      #[\AllowDynamicProperties]
      class Lifecycle {
      
      
          /** @var array the version numbers that have an upgrade routine */
      Severity: Minor
      Found in woocommerce/Lifecycle.php - About 2 hrs to fix

        SV_WC_Payment_Gateway_Direct has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        #[\AllowDynamicProperties]
        abstract class SV_WC_Payment_Gateway_Direct extends SV_WC_Payment_Gateway {
        
        
            /**
        Severity: Minor
        Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php - About 2 hrs to fix

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

              protected function get_tokens() {
          
                  if ( ! empty( $this->tokens ) ) {
                      return $this->tokens;
                  }

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

              public function get_incompatible_php_settings() {
          
                  $incompatible_settings = [];
          
                  if ( function_exists( 'ini_get' ) ) {
          Severity: Minor
          Found in woocommerce/class-sv-wc-plugin-dependencies.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 enqueue_scripts has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function enqueue_scripts( $hook_suffix ) {
                  global $post, $theorder;
          
                  // Order screen assets
                  if ( SV_WC_Order_Compatibility::is_order( $post ) || SV_WC_Order_Compatibility::is_order( $theorder ) ) {

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

              public function init_form_fields() {
          
                  // common top form fields
                  $this->form_fields = array(
          
          
          Severity: Minor
          Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway.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 process_payment has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function process_payment( $payment_data, $product_id ) {
          
                  $order = null;
          
                  try {

            SV_WC_Payment_Gateway_Admin_Payment_Token_Editor has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            #[\AllowDynamicProperties]
            class SV_WC_Payment_Gateway_Admin_Payment_Token_Editor {
            
            
                /** @var SV_WC_Payment_Gateway_Direct the gateway object **/

              SV_WC_Payment_Gateway_Integration_Subscriptions has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              #[\AllowDynamicProperties]
              class SV_WC_Payment_Gateway_Integration_Subscriptions extends SV_WC_Payment_Gateway_Integration {
              
              
                  /** @var string|float renewal payment total for Subs 2.0.x renewals */

                Frontend has 24 functions (exceeds 20 allowed). Consider refactoring.
                Open

                #[\AllowDynamicProperties]
                abstract class Frontend extends Script_Handler {
                
                
                    /** @var SV_WC_Payment_Gateway_Plugin $plugin the gateway plugin instance */
                Severity: Minor
                Found in woocommerce/payment-gateway/External_Checkout/Frontend.php - About 2 hrs to fix

                  Method init_form_fields has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function init_form_fields() {
                  
                          // common top form fields
                          $this->form_fields = array(
                  
                  
                  Severity: Major
                  Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway.php - About 2 hrs to fix

                    Function constructor has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            constructor( params ) {
                    
                                let {
                                    plugin_id,
                                    merchant_id,

                      Function is_plugin_active has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function is_plugin_active( $plugin_name ) {
                      
                              $is_active = false;
                      
                              if ( is_string( $plugin_name ) ) {
                      Severity: Minor
                      Found in woocommerce/class-sv-wc-plugin.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 add_capture_button has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function add_capture_button( $order ) {
                      
                              // only display the button for core orders
                              if ( ! SV_WC_Order_Compatibility::is_order( $order ) ) {
                                  return;

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

                          protected function add_ssl_admin_notices() {
                      
                              if ( ! $this->requires_ssl() ) {
                                  return;
                              }
                      Severity: Minor
                      Found in woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.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

                      Severity
                      Category
                      Status
                      Source
                      Language