tuhin18003/WooCommerce-AltCoin-Payment-Gateway

View on GitHub

Showing 92 of 92 total issues

Avoid too many return statements within this method.
Open

                return wp_send_json(
                    Util::notice_html(
                        array(
                            'success'  => false,
                            'response' => $response_msg,
Severity: Major
Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return wp_send_json(
                    Util::notice_html(
                        array(
                            'error'    => true,
                            'response' => __( 'Cart information not found! Please uninstall the this plugin and install a fresh copy then upgrade your WooCommerce store. ', 'woo-altcoin-payment-gateway' ),
    Severity: Major
    Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return wp_send_json(
                          Util::notice_html(
                              array(
                                  'success'              => false,
                                  // 'response' => __( 'Transaction on processing. Getting confirmation data..', 'woo-altcoin-payment-gateway' )
      Severity: Major
      Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return wp_send_json(
                        Util::notice_html(
                            array(
                                'error'    => true,
                                'response' => __( 'Unable to retrieve rest api data from server. Please make sure your server allow to call rest api.', 'woo-altcoin-payment-gateway' ),
        Severity: Major
        Found in core/frontend/functions/CsWapgAutoOrderConfirm.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return wp_send_json( $this->get_auto_order_coins_list() );
          Severity: Major
          Found in core/admin/functions/CsAdminQuery.php - About 30 mins to fix

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

                    private static function load_action_files() {
                        foreach ( glob( CS_WAPG_BASE_DIR_PATH . 'core/actions/*.php' ) as $cs_action_file ) {
                            $class_name = basename( $cs_action_file, '.php' );
                            $class      = self::$namespace . '\\actions\\' . $class_name;
                            if ( class_exists( $class ) && ! array_key_exists( $class, self::$wapg_hooks ) ) { // check class doesn't load multiple time
            Severity: Minor
            Found in woocommerce-altcoin-payment.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

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

                private function get_auto_order_coins_list() {
                    // get data from portal
                    $user_data  = CsAutomaticOrderConfirmationSettings::get_order_confirm_settings_data();
                    $api_status = Util::remote_call(
                        $this->auto_order_coins_list_url,
            Severity: Minor
            Found in core/admin/functions/CsAdminQuery.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

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

                public function wapg_order_coin_details_metabox() {
                    global $post;
            
                    if ( isset( $post->post_type ) && $post->post_type != 'shop_order' ) {
                        return '';
            Severity: Minor
            Found in core/actions/WooHooks.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

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

                public static function temp_update_trx_info( $trxid, $secret_word, $order_id = 0 ) {
                    global $wpdb, $wapg_tables;
                    $check_trxid_exists = $wpdb->get_var( $wpdb->prepare( " select id from {$wapg_tables['coin_trxids']} where transaction_id = '%s' ", $trxid ) );
                    if ( $check_trxid_exists ) {
                        $check_coin_exists = $wpdb->get_var( $wpdb->prepare( " select id from {$wapg_tables['coin_trxids']} where secret_word = '%s' ", Util::check_evil_script( $secret_word ) ) );
            Severity: Minor
            Found in core/lib/cartFunctions.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

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

                public static function import_old_settins() {
                    $get_installed_plugin_version = get_site_option( 'wapg_plugin_version' );
            
                    if ( \version_compare( $get_installed_plugin_version, '1.2.4', '>=' ) ) {
                        return; // already imported old settings
            Severity: Minor
            Found in core/install/Activate.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

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

                public function get_all_coins_list( $slug = array() ) {
            
                    $request_params = empty( $slug ) ? '' : '?' . http_build_query( $slug );
            
                    $api_status = Util::remote_call(
            Severity: Minor
            Found in core/admin/functions/CsAdminQuery.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

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

                public function wapg_get_plugins_info() {
                    $isAutoOrder = CsAutomaticOrderConfirmationSettings::get_order_confirm_settings_data();
            
                    if ( empty( $isAutoOrder ) ) {
                        return;
            Severity: Minor
            Found in core/admin/functions/WooFunctions.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

            Severity
            Category
            Status
            Source
            Language