tuhin18003/WooCommerce-AltCoin-Payment-Gateway

View on GitHub

Showing 87 of 92 total issues

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