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

View on GitHub

Showing 427 of 427 total issues

Function display_custom_options has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

        function display_custom_options( $buf, $args ) {
            if ( $args['name'] == "{$this->prefix}addl_pages" ) {
                $buf .= "<div id='{$this->prefix}addl_pages'>";
                if ( !empty( $args['value'] ) ) {
                    $buf .= "<table class='aioseop_table' cellpadding=0 cellspacing=0>\n";
Severity: Minor
Found in aioseop_sitemap.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

Function get_all_images has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

        function get_all_images( $options = null, $p = null ) {
            static $img = Array();
            if ( !is_array( $options ) ) $options = Array();
            if ( !empty( $this->options['aiosp_opengraph_meta_key'] ) )
                $options['meta_key'] = $this->options['aiosp_opengraph_meta_key'];
Severity: Minor
Found in aioseop_opengraph.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

File aioseop_importer_exporter.php has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @package All-in-One-SEO-Pack 
 */
/**
Severity: Minor
Found in aioseop_importer_exporter.php - About 2 hrs to fix

    Method display_options has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function display_options( $location = null, $meta_args = null ) {
                    static $location_settings = Array();
                    $defaults = null;
                    $prefix = $this->get_prefix( $location );
                    $help_link = '';
    Severity: Major
    Found in aioseop_module_class.php - About 2 hrs to fix

      Method display_right_sidebar has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function display_right_sidebar( ) { ?>
              
      <?php
      /* <label class="aioseop_generic_label"><?php _e('Click on option titles to get help!', 'all-in-one-seo-pack' ); ?></label> */
              global $wpdb;
      Severity: Major
      Found in aioseop_class.php - About 2 hrs to fix

        Method __construct has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function sanitize_options has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

                  function sanitize_options( $location = null ) {
                      foreach ( $this->setting_options( $location ) as $k => $v ) {
                          if ( isset( $this->options[$k] ) ) {
                              if ( !empty( $v['sanitize'] ) )
                                  $type = $v['sanitize'];
          Severity: Minor
          Found in aioseop_module_class.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

          Function aioseop_update_settings_check has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              function aioseop_update_settings_check() {
                  global $aioseop_options;
                  if ( ( isset( $_POST['aioseop_migrate_options'] ) )  ||
                       ( empty( $aioseop_options ) ) )
                      aioseop_mrt_mkarry();
          Severity: Minor
          Found in aioseop_functions.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

          Function add_help_text_links has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

                  function add_help_text_links() {
                      if ( !empty( $this->help_text ) ) {
                          foreach( $this->layout as $k => $v ) {
                              $this->help_text_helper( $this->default_options, $v['options'], $v['help_link'] );
                          }
          Severity: Minor
          Found in aioseop_module_class.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

          Function load_sitemap_options has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

                  function load_sitemap_options() {
                      // load initial options / set defaults
                      $this->update_options( );
                      if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) {
                          $this->paginate = true;
          Severity: Minor
          Found in aioseop_sitemap.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

          Function do_sitemaps has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

                  function do_sitemaps( $message = '' ) {
                      if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) {
                          $this->paginate = true;
                          if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
                              $this->max_posts = $this->options["{$this->prefix}max_posts"];
          Severity: Minor
          Found in aioseop_sitemap.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 filter_options has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function filter_options( $options, $location ) {
                      if ( $location ) $prefix = $this->get_prefix( $location ) . $location . '_';
                      if ( $location === 'generator' ) {
                              $optimize = false;
                              $robotgen = '';
          Severity: Major
          Found in aioseop_robots.php - About 2 hrs to fix

            Method output_sitemap has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function output_sitemap( $urls, $comment = '' ) {
                        $max_items = 50000;
                        if ( !is_array( $urls ) ) return null;
                        echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n\r\n";
                        echo "<!-- " . sprintf( $this->comment_string, $comment, AIOSEOP_VERSION, date('D, d M Y H:i:s e') ) . " -->\r\n";
            Severity: Major
            Found in aioseop_sitemap.php - About 2 hrs to fix

              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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                    if ( ( $this->options[ $this->prefix . 'freq_post' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) ) ) {
                                        if ( ( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] != 'no' ) && ( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] != 'sel' ) )
                                            $pr_info[ 'changefreq' ] = $this->options[ $this->prefix . 'freq_post_' . $post->post_type ];
                                    }
                Severity: Major
                Found in aioseop_sitemap.php and 1 other location - About 2 hrs to fix
                aioseop_sitemap.php on lines 1521..1524

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 127.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                    if ( ( $this->options[ $this->prefix . 'prio_post' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) ) ) {
                                        if ( ( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] != 'no' ) && ( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] != 'sel' ) )
                                            $pr_info[ 'priority' ] = $this->options[ $this->prefix . 'prio_post_' . $post->post_type ];
                                    }
                Severity: Major
                Found in aioseop_sitemap.php and 1 other location - About 2 hrs to fix
                aioseop_sitemap.php on lines 1525..1528

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 127.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method __construct has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function debug_post_types has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                          function debug_post_types( ) {
                              $post_types = $this->get_post_type_titles( );
                              $rempost = array( 'attachment' => 1, 'revision' => 1, 'nav_menu_item' => 1 );
                              $this->default_options['export_post_types']['initial_options']  = array_diff_key( $post_types, $rempost );
                              
                  Severity: Minor
                  Found in aioseop_importer_exporter.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

                  Function get_the_image_by_attachment has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                          function get_the_image_by_attachment( $p = null ) {
                              
                              if ( $p === null ) {
                                  global $post;
                              } else {
                  Severity: Minor
                  Found in aioseop_module_class.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

                  Function rename_file has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                          function rename_file( $filename, $newname ) {
                              $wpfs = $this->get_filesystem_object();
                              if ( is_object( $wpfs ) ) {
                                  $file_exists = $wpfs->exists( $filename );
                                  $newfile_exists = $wpfs->exists( $newname );
                  Severity: Minor
                  Found in aioseop_module_class.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

                  Severity
                  Category
                  Status
                  Source
                  Language