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

View on GitHub

Showing 399 of 427 total issues

Function filter_options has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

        function filter_options( $options, $location ) {
            if ( $location == 'settings' ) {
                $prefix = $this->get_prefix( $location ) . $location . '_';
                list( $legacy, $images ) = $this->get_all_images( $options );
                if ( isset( $options ) && isset( $options["{$prefix}image"] ) ) {
Severity: Minor
Found in aioseop_opengraph.php - About 4 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 sitemap_output_hook has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

        function sitemap_output_hook($query) {
            $page = 0;
            if ( ( $this->options["{$this->prefix}rewrite"] ) )
                if( !empty( $query->query_vars["{$this->prefix}path"] ) ) {
                    if( !empty( $query->query_vars["{$this->prefix}page"] ) )
Severity: Minor
Found in aioseop_sitemap.php - About 4 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 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

    Function save_post_data has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        function save_post_data( $id ) {
            $awmp_edit = $nonce = null;
            if ( empty( $_POST ) ) return false;
            if ( isset( $_POST[ 'aiosp_edit' ] ) )                $awmp_edit = $_POST['aiosp_edit'];
            if ( isset( $_POST[ 'nonce-aioseop-edit' ] ) )        $nonce     = $_POST['nonce-aioseop-edit'];
    Severity: Minor
    Found in aioseop_class.php - About 4 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 get_admin_links has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_admin_links() {
                if ( !empty( $this->menu_name ) )
                    $name = $this->menu_name;
                else
                    $name = $this->name;
    Severity: Minor
    Found in aioseop_module_class.php - About 4 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 ( get_query_var( 'm' ) ) {
                $m = preg_replace( '/[^0-9]/', '', get_query_var( 'm' ) );
                switch ( $this->strlen( $m ) ) {
                    case 4: $link = get_year_link( $m ); break;
                    case 6: $link = get_month_link( $this->substr( $m, 0, 4), $this->substr($m, 4, 2 ) ); break;
    Severity: Critical
    Found in aioseop_class.php - About 4 hrs to fix

      Function encode has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          function encode($var)
          {
              switch (gettype($var)) {
                  case 'boolean':
                      return $var ? 'true' : 'false';
      Severity: Minor
      Found in JSON.php - About 4 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 get_main_description has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          function get_main_description( $post = null ) {
              global $aioseop_options;
              $opts = $this->meta_opts;
              $description = '';
              if ( is_author()  && $this->show_page_description() ) {
      Severity: Minor
      Found in aioseop_class.php - About 4 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 save_post_data has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

              function save_post_data( $post_id ) {
                  static $update = false;
                  if ( $update ) return;
                  if ( $this->locations !== null ) {
                      foreach( $this->locations as $k => $v ) {
      Severity: Minor
      Found in aioseop_module_class.php - About 4 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 handle_settings_updates has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

              function handle_settings_updates( $location = null ) {
                  $message = '';
                  if ( (isset($_POST['action']) && $_POST['action'] == 'aiosp_update_module' &&
                       ( isset( $_POST['Submit_Default'] ) || isset( $_POST['Submit_All_Default'] ) || !empty( $_POST['Submit'] ) ) ) ) {
                      $nonce = $_POST['nonce-aioseop'];
      Severity: Minor
      Found in aioseop_module_class.php - About 4 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 enqueue_metabox_scripts has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

              function enqueue_metabox_scripts( ) {
                  $screen = '';
                  if ( function_exists( 'get_current_screen' ) )
                      $screen = get_current_screen();
                  $bail = false;
      Severity: Minor
      Found in aioseop_module_class.php - About 4 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 add_page_icon has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function add_page_icon() {
              wp_enqueue_script( 'wp-pointer', false, array( 'jquery' ) );
              wp_enqueue_style( 'wp-pointer' );
              $this->add_admin_pointers();
              ?>
      Severity: Major
      Found in aioseop_class.php - About 4 hrs to fix

        Function load_file has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

                function load_file( $filename, $use_include_path = false, $context = null, $offset = -1, $maxlen = -1 ) {
                    $wpfs = $this->get_filesystem_object();
                    if ( is_object( $wpfs ) ) {
                        if ( !$wpfs->exists( $filename ) ) return false;
                        if ( ( $offset > 0 ) || ( $maxlen >= 0 ) ) {
        Severity: Minor
        Found in aioseop_module_class.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

        Function scan_match_files has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

                function scan_match_files() {
                    $scan1 = $scan2 = '';
                    $files = Array();
                    
                    if ( !empty( $this->options["{$this->prefix}filename"] ) ) {
        Severity: Minor
        Found in aioseop_sitemap.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

        Function get_comment_count_stats has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_comment_count_stats( $posts ) {
                    $count = 0;
                    $total = 0.0;
                    $min = null;
                    $max = 0;
        Severity: Minor
        Found in aioseop_sitemap.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 admin_menu has 97 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function admin_menu() {
                $file = plugin_basename( __FILE__ );
                $menu_name = __( 'All in One SEO', 'all-in-one-seo-pack' );
        
                $this->locations['aiosp']['default_options']['nonce-aioseop-edit']['default'] = wp_create_nonce('edit-aioseop-nonce');
        Severity: Major
        Found in aioseop_class.php - About 3 hrs to fix

          Function is_page_included has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              function is_page_included() {
                  global $aioseop_options;
                  if ( is_feed() ) return false;
                  if ( aioseop_mrt_exclude_this_page() ) return false;
                  $post = $this->get_queried_object();
          Severity: Minor
          Found in aioseop_class.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

          Function generate_htaccess_blocklist has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

                  function generate_htaccess_blocklist() {
                      if ( !$this->option_isset( 'htaccess_rules' ) ) return;
                      if ( function_exists( 'apache_get_modules' ) ) {
                          $modules = apache_get_modules();
                          foreach( Array( 'mod_authz_host', 'mod_setenvif' ) as $m ) {
          Severity: Minor
          Found in aioseop_bad_robots.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 get_page_snippet_info has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function get_page_snippet_info() {
                  static $info = Array();
                  if ( !empty( $info ) )
                      return $info;
                  global $post, $aioseop_options, $wp_query;
          Severity: Major
          Found in aioseop_class.php - About 3 hrs to fix

            Function post_data_export has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                    function post_data_export( $prefix = '_aioseop', $query = Array( 'posts_per_page' => -1 ) ) {
                        $buf = '';
                        $posts_query = new WP_Query( $query );
                        while ($posts_query->have_posts() ) {
                            $posts_query->the_post();
            Severity: Minor
            Found in aioseop_module_class.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

            Severity
            Category
            Status
            Source
            Language