tuhin18003/WooCommerce-AltCoin-Payment-Gateway

View on GitHub
core/install/Activate.php

Summary

Maintainability
C
1 day
Test Coverage

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

    public static function check_db_status() {
        global $wapg_current_db_version, $wpdb, $wapg_tables;
        $get_installed_db_version = get_site_option( 'wapg_db_version' );
        if ( empty( $get_installed_db_version ) ) {
            self::on_activate();
Severity: Minor
Found in core/install/Activate.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

Method check_db_status has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function check_db_status() {
        global $wapg_current_db_version, $wpdb, $wapg_tables;
        $get_installed_db_version = get_site_option( 'wapg_db_version' );
        if ( empty( $get_installed_db_version ) ) {
            self::on_activate();
Severity: Major
Found in core/install/Activate.php - About 2 hrs to fix

    Function import_coin_symbol has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function import_coin_symbol() {
            global $wapg_current_db_version, $wpdb, $wapg_tables;
    
            $CsAdminQuery = new CsAdminQuery();
    
    
    Severity: Minor
    Found in core/install/Activate.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 on_activate has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function on_activate() {
            global $wpdb, $wapg_tables;
            $charset_collate = $wpdb->get_charset_collate();
    
            $sqls = array(
    Severity: Minor
    Found in core/install/Activate.php - About 1 hr to fix

      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

      There are no issues that match your filters.

      Category
      Status