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

View on GitHub
aioseop_module_manager.php

Summary

Maintainability
D
2 days
Test Coverage

Function load_module has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

        function load_module( $mod ) {
            static $feature_options = null;
            static $feature_prefix = null;
            if ( !is_array( $this->modules ) ) return false;
            $v = $this->modules[ $mod ];
Severity: Minor
Found in aioseop_module_manager.php - About 6 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

Function __construct has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

        function __construct( $mod ) {
            $this->modules['feature_manager'] = null;
            foreach ( $mod as $m ) $this->modules[$m] = null;
            $reset = false;
            $reset_all = ( isset( $_POST['Submit_All_Default'] ) && $_POST['Submit_All_Default']!='' );
Severity: Minor
Found in aioseop_module_manager.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

Consider simplifying this complex logical expression.
Open

if ( !class_exists( 'All_in_One_SEO_Pack_Module_Manager' ) ) {
    class All_in_One_SEO_Pack_Module_Manager {
        protected $modules = Array();
        protected $settings_update = false;
        protected $settings_reset = false;
Severity: Critical
Found in aioseop_module_manager.php - About 2 hrs to fix

    Method load_module has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function load_module( $mod ) {
                static $feature_options = null;
                static $feature_prefix = null;
                if ( !is_array( $this->modules ) ) return false;
                $v = $this->modules[ $mod ];
    Severity: Minor
    Found in aioseop_module_manager.php - About 1 hr to fix

      Function return_module has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              function return_module( $class ) {
                  global $aiosp;
                  if ( $class == get_class( $aiosp ) )    return $aiosp;
                  if ( $class == get_class( $this ) )        return $this;
                  foreach( $this->modules as $m )
      Severity: Minor
      Found in aioseop_module_manager.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

      Consider simplifying this complex logical expression.
      Open

                  if ( ( $mod == 'file_editor' || $mod == 'robots' )
                                               && ( ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) 
                                               || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
                                               || !is_super_admin() ) ) )
                      return false;
      Severity: Major
      Found in aioseop_module_manager.php - About 1 hr to fix

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

                function get_loaded_module_list() {
                    $module_list = Array();
                    if ( !empty( $this->modules ) ) {
                        foreach( $this->modules as $k => $v )
                            if ( !empty( $v ) )
        Severity: Minor
        Found in aioseop_module_manager.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 do_load_module has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                function do_load_module( $mod, $args = null ) {
                    $mod_path = apply_filters( "aioseop_include_$mod", AIOSEOP_PLUGIN_DIR . "aioseop_$mod.php" );
                    if ( !empty( $mod_path ) )
                        require_once( $mod_path );
                    $ref = "aioseop_$mod";
        Severity: Minor
        Found in aioseop_module_manager.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

        Avoid too many return statements within this method.
        Open

                    if ( $mod_enable ) return $this->do_load_module( $mod );
        Severity: Major
        Found in aioseop_module_manager.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return false;
          Severity: Major
          Found in aioseop_module_manager.php - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status