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

View on GitHub

Showing 427 of 427 total issues

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

            foreach( $taxonomy_titles as $k => $v ) {
                $key = 'prio_taxonomies_' . $k;
                $this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_taxonomies', Array( $key => Array( 'name' => $v . $tax_name, 'help_text' => $prio_help . $v . $tax_name, 'type' => 'select', 'initial_options' => $this->prio, 'default' => 'no', 'condshow' => Array( "{$this->prefix}prio_taxonomies" => 'sel' ) ) ) );                
                $this->layout['priorities']['options'][] = $key;
                $key = 'freq_taxonomies_' . $k;
Severity: Major
Found in aioseop_sitemap.php and 1 other location - About 7 hrs to fix
aioseop_sitemap.php on lines 304..311

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 240.

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

Function get_ini_file has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

        function get_ini_file( $assoc_arr, $has_sections=TRUE ) { 
            $content = ""; 
            if ($has_sections) { 
                foreach ($assoc_arr as $key=>$elem) { 
                    $content .= "[".$key."]\n"; 
Severity: Minor
Found in aioseop_importer_exporter.php - About 7 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_child_sitemap_urls has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

        function get_child_sitemap_urls() {
            $siteurls = Array();
            $blogs = $this->get_child_blogs();
            if ( !empty( $blogs ) ) {
                $option_name = $this->get_option_name();
Severity: Minor
Found in aioseop_sitemap.php - About 7 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_robots_meta has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    function get_robots_meta() {
        global $aioseop_options;
        $opts = $this->meta_opts;
        $page = $this->get_page_number();
        $robots_meta = $tax_noindex = '';
Severity: Minor
Found in aioseop_class.php - About 7 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 filter_options has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

        function filter_options( $options ) {
            if ( !isset( $this->default_options['posttypes' ]['initial_options'] ) ) $this->add_post_types();
            if ( is_array( $options["{$this->prefix}posttypes"] ) && in_array( 'all', $options["{$this->prefix}posttypes"] ) && is_array( $this->default_options['posttypes' ]['initial_options'] ) )
                $options["{$this->prefix}posttypes"] = array_keys( $this->default_options['posttypes' ]['initial_options'] );
            if ( is_array( $options["{$this->prefix}taxonomies"] ) && in_array( 'all', $options["{$this->prefix}taxonomies"] ) && is_array( $this->default_options['taxonomies' ]['initial_options'] ) )
Severity: Minor
Found in aioseop_sitemap.php - About 7 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_aioseop_title has 178 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function get_aioseop_title( $post ) {
        global $aioseop_options;
        // the_search_query() is not suitable, it cannot just return
        global $s, $STagging;
        $opts = $this->meta_opts;
Severity: Major
Found in aioseop_class.php - About 7 hrs to fix

    Function aiosp_mrt_get_url has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        function aiosp_mrt_get_url( $query, $show_page = true ) {
            if ( $query->is_404 || $query->is_search )
                return false;
            
            $link = '';
    Severity: Minor
    Found in aioseop_class.php - About 7 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 display_settings_page has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

            function display_settings_page( $location = null ) {
                    if ( $location != null ) $location_info = $this->locations[$location];
                    $name = null;
                    if ( ( $location ) && ( isset( $location_info['name'] ) ) ) $name = $location_info['name'];
                    if ( !$name ) $name = $this->name;
    Severity: Minor
    Found in aioseop_module_class.php - About 7 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 decode has 171 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function decode($str)
        {
            $str = $this->reduce_string($str);
    
            switch (strtolower($str)) {
    Severity: Major
    Found in JSON.php - About 6 hrs to fix

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

              function __construct( ) {
                  if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class
                      $this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
                      $this->prefix = 'aiosp_sitemap_';                          // option prefix
                      $this->file = __FILE__;                                      // the current file
      Severity: Major
      Found in aioseop_sitemap.php - About 6 hrs to fix

        Function aioseop_ajax_scan_header has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

            function aioseop_ajax_scan_header() {
                $_POST["options"] = "foo";
                aioseop_ajax_init();
                $options = Array();
                parse_str( $_POST['options'], $options );
        Severity: Minor
        Found in aioseop_functions.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

        File aioseop_utility.php has 444 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * @package All-in-One-SEO-Pack
         */
        $UTF8_TABLES = Array();
        Severity: Minor
        Found in aioseop_utility.php - About 6 hrs to fix

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

                  function debug_message( $msg ) {
                      if ( empty( $this->options["{$this->prefix}debug"] ) ) $this->options["{$this->prefix}debug"] = '';
                      $this->options["{$this->prefix}debug"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}debug"];
                      if ( $this->strlen( $this->options["{$this->prefix}debug"] ) > 2048 ) {
                          $end = $this->strrpos( $this->options["{$this->prefix}debug"], "\n" );
          Severity: Major
          Found in aioseop_sitemap.php and 1 other location - About 6 hrs to fix
          aioseop_bad_robots.php on lines 128..137

          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 216.

          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

                  function blocked_message( $msg ) {
                      if ( empty( $this->options["{$this->prefix}blocked_log"] ) ) $this->options["{$this->prefix}blocked_log"] = '';
                      $this->options["{$this->prefix}blocked_log"] = date( 'Y-m-d H:i:s' ) . " {$msg}\n" . $this->options["{$this->prefix}blocked_log"];
                      if ( $this->strlen( $this->options["{$this->prefix}blocked_log"] ) > 4096 ) {
                          $end = $this->strrpos( $this->options["{$this->prefix}blocked_log"], "\n" );
          Severity: Major
          Found in aioseop_bad_robots.php and 1 other location - About 6 hrs to fix
          aioseop_sitemap.php on lines 618..627

          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 216.

          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

          Function filter_settings has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
          Open

                  function filter_settings( $settings, $location, $current ) {
                      if ( $location == 'opengraph' || $location == 'settings' ) {
                          $prefix = $this->get_prefix( $location ) . $location . '_';
                          if ( $location == 'opengraph' ) return $settings;
                          if ( $location == 'settings'  ) {
          Severity: Minor
          Found in aioseop_opengraph.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 aiosp_google_analytics has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
          Open

          function aiosp_google_analytics() {
              global $aioseop_options;
              $analytics = '';
              if ( !empty( $aioseop_options['aiosp_ga_advanced_options'] ) && !empty( $aioseop_options['aiosp_ga_exclude_users'] ) ) {
                  if ( is_user_logged_in() ) {
          Severity: Minor
          Found in aioseop_class.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 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 get_simple_sitemap has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
          Open

                  function get_simple_sitemap() {
                      $home = Array(
                                  'loc' => get_home_url(),
                                  'priority' => $this->get_default_priority( 'homepage' ),
                                  'changefreq' => $this->get_default_frequency( 'homepage' )
          Severity: Minor
          Found in aioseop_sitemap.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

          Consider simplifying this complex logical expression.
          Open

                  if ( ( is_category() && !empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( !is_category() && is_archive() && !is_tag() && !is_tax()
                      && ( ( is_date() && !empty( $aioseop_options['aiosp_archive_date_noindex'] ) ) || ( is_author() && !empty( $aioseop_options['aiosp_archive_author_noindex'] ) ) ) ) 
                      || ( is_tag() && !empty( $aioseop_options['aiosp_tags_noindex'] ) ) 
                      || ( is_search() && !empty( $aioseop_options['aiosp_search_noindex'] ) )
                       || ( is_404() && !empty( $aioseop_options['aiosp_404_noindex'] ) )
          Severity: Critical
          Found in aioseop_class.php - About 6 hrs to fix

            Method default_bad_bots has 144 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function default_bad_bots() {
                        $botlist = Array(
                            "Abonti",
                            "aggregator",
                            "AhrefsBot",
            Severity: Major
            Found in aioseop_module_class.php - About 5 hrs to fix
              Severity
              Category
              Status
              Source
              Language