awsmug/torro-forms

View on GitHub
src/components/legacy-upgrades.php

Summary

Maintainability
F
6 days
Test Coverage

Function upgrade_legacy_form_meta has a Cognitive Complexity of 118 (exceeds 5 allowed). Consider refactoring.
Open

    public function upgrade_legacy_form_meta( $form_id ) {
        global $wpdb;

        $prefix = $this->get_prefix();

Severity: Minor
Found in src/components/legacy-upgrades.php - About 2 days 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 legacy-upgrades.php has 473 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Legacy upgrades class
 *
 * @package TorroForms
Severity: Minor
Found in src/components/legacy-upgrades.php - About 7 hrs to fix

    Method upgrade_legacy_form_meta has 169 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function upgrade_legacy_form_meta( $form_id ) {
            global $wpdb;
    
            $prefix = $this->get_prefix();
    
    
    Severity: Major
    Found in src/components/legacy-upgrades.php - About 6 hrs to fix

      Function upgrade_legacy_settings has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          public function upgrade_legacy_settings() {
              $prefix = $this->get_prefix();
      
              $general_mappings = array(
                  'modules'        => array( $prefix . 'settings_general_modules', 'modules' ),
      Severity: Minor
      Found in src/components/legacy-upgrades.php - About 5 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 upgrade_legacy_settings has 88 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function upgrade_legacy_settings() {
              $prefix = $this->get_prefix();
      
              $general_mappings = array(
                  'modules'        => array( $prefix . 'settings_general_modules', 'modules' ),
      Severity: Major
      Found in src/components/legacy-upgrades.php - About 3 hrs to fix

        Method upgrade_to_1_0_10 has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function upgrade_to_1_0_10() {
                global $wpdb;
        
                $containers          = $this->get_full_table_name( 'containers' );
                $elements            = $this->get_full_table_name( 'elements' );
        Severity: Major
        Found in src/components/legacy-upgrades.php - About 2 hrs to fix

          Method upgrade has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function upgrade( $legacy_db_version ) {
                  $last_legacy_db_version = '1.0.10';
          
                  if ( $legacy_db_version === $last_legacy_db_version ) {
                      return;
          Severity: Minor
          Found in src/components/legacy-upgrades.php - About 1 hr to fix

            Method maybe_upgrade_legacy_form_attachment_statuses has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function maybe_upgrade_legacy_form_attachment_statuses() {
                    global $wpdb;
            
                    if ( get_option( $this->get_prefix() . 'legacy_attachments_need_migration' ) !== 'true' ) {
                        return false;
            Severity: Minor
            Found in src/components/legacy-upgrades.php - About 1 hr to fix

              Function upgrade has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function upgrade( $legacy_db_version ) {
                      $last_legacy_db_version = '1.0.10';
              
                      if ( $legacy_db_version === $last_legacy_db_version ) {
                          return;
              Severity: Minor
              Found in src/components/legacy-upgrades.php - About 55 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 maybe_upgrade_legacy_form_attachment_statuses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function maybe_upgrade_legacy_form_attachment_statuses() {
                      global $wpdb;
              
                      if ( get_option( $this->get_prefix() . 'legacy_attachments_need_migration' ) !== 'true' ) {
                          return false;
              Severity: Minor
              Found in src/components/legacy-upgrades.php - About 35 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