wp-plugins/all-in-one-seo-pack

View on GitHub
aioseop_performance.php

Summary

Maintainability
D
2 days
Test Coverage

Function get_serverinfo has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

        function get_serverinfo() {
            global $wpdb;
            global $wp_version;

                $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
Severity: Minor
Found in aioseop_performance.php - About 1 day 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_serverinfo has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function get_serverinfo() {
            global $wpdb;
            global $wp_version;

                $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
Severity: Major
Found in aioseop_performance.php - About 4 hrs to fix

    Method All_in_One_SEO_Pack_Performance has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function All_in_One_SEO_Pack_Performance( $mod ) {
                $this->name = __('Performance', 'all-in-one-seo-pack');        // Human-readable name of the plugin
                $this->prefix = 'aiosp_performance_';                        // option prefix
                $this->file = __FILE__;                                    // the current file
                parent::__construct();
    Severity: Major
    Found in aioseop_performance.php - About 2 hrs to fix

      Function add_page_hooks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              function add_page_hooks() {
                  $memory_usage = memory_get_peak_usage() / 1024 / 1024;
                  if ( $memory_usage > 32 ) {
                      unset( $this->default_options['memory_limit']['initial_options']['32M'] );
                      if ( $memory_usage > 64 )  unset( $this->default_options['memory_limit']['initial_options']['64M'] );
      Severity: Minor
      Found in aioseop_performance.php - About 1 hr 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 settings_update_action has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              function settings_update_action( $options, $location ) {
                  if ( $location == null ) {
                      if ( isset( $_POST[ $this->prefix . 'force_rewrites' ] ) ) {
                          $force_rewrites = $_POST[ $this->prefix . 'force_rewrites' ];
                          if ( ( $force_rewrites == 0 ) || ( $force_rewrites == 1 ) ) {
      Severity: Minor
      Found in aioseop_performance.php - About 1 hr 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