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

View on GitHub

Showing 427 of 427 total issues

Method aioseop_ajax_get_menu_links has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function aioseop_ajax_get_menu_links() {
        aioseop_ajax_init();
        $options = Array();
        parse_str( $_POST['options'], $options );
        $_POST = $options;
Severity: Minor
Found in aioseop_functions.php - About 2 hrs to fix

    Function get_post_title_format has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        function get_post_title_format( $title_type = 'post', $p = null ) {
            global $aioseop_options;
            if ( ( $title_type != 'post' ) && ( $title_type != 'archive' ) ) return false;
            $title_format = "%{$title_type}_title% | %blog_title%";
            if ( isset( $aioseop_options["aiosp_{$title_type}_title_format"] ) )
    Severity: Minor
    Found in aioseop_class.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 get_current_options has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_current_options( $opts = Array(), $location = null, $defaults = null, $post = null ) {
                $prefix = $this->get_prefix( $location );
                $get_opts = '';
                if ( empty( $location ) )
                    $type = 'settings';
    Severity: Minor
    Found in aioseop_module_class.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 get_filesystem_object has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_filesystem_object( ) {
                $cred = get_transient( 'aioseop_fs_credentials' );
                if ( !empty( $cred ) ) $this->credentials = $cred;
                
                if ( function_exists( 'WP_Filesystem' ) && ( WP_Filesystem( $this->credentials ) ) ) {
    Severity: Minor
    Found in aioseop_module_class.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_page_init has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

            function settings_page_init() {
                add_filter( 'aiosp_output_option', Array( $this, 'display_custom_options' ), 10, 2 );
                $cat = $this->options["{$this->prefix}categories"];
                if ( !empty( $cat ) ) {
                    if ( $cat == 'blog' ) {
    Severity: Minor
    Found in aioseop_opengraph.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

    Method get_robots_meta has 46 lines of code (exceeds 25 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 1 hr to fix

      Method annotate_robots_html has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function annotate_robots_html( $file, $show_help = false, $title = '' ) {
                  $robots = $this->annotate_robots( $file );
                  if( !empty( $robots ) ){
                      $buf = '<table class="widefat" ><thead>';
                      if ( !empty( $title ) ) {
      Severity: Minor
      Found in aioseop_robots.php - About 1 hr to fix

        Method get_all_post_type_data has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function get_all_post_type_data( $args ) {
                    $defaults = array(
                        'numberposts' => $this->max_posts, 'offset' => 0,
                        'category' => 0, 'orderby' => 'post_date',
                        'order' => 'DESC', 'include' => array(),
        Severity: Minor
        Found in aioseop_sitemap.php - About 1 hr to fix

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

                          if ( !empty( $this->options['aiosp_cpostnoindex'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoindex'] ) ) ) {
                              $settings["{$prefix}noindex"]['type'] = 'select';
                              $settings["{$prefix}noindex"]['initial_options'] = Array( '' => __( 'Default - noindex', 'all-in-one-seo-pack' ), 'off' => __( 'index', 'all-in-one-seo-pack' ), 'on' => __( 'noindex', 'all-in-one-seo-pack' ) );
                          }
          Severity: Major
          Found in aioseop_class.php and 3 other locations - About 1 hr to fix
          aioseop_class.php on lines 1224..1227
          aioseop_class.php on lines 1228..1231
          aioseop_class.php on lines 1232..1235

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

          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

                              } elseif ( stripos($l, 'disallow') === 0) {
                                  if ($state < 3) {
                                      $rules[] = Array( 'state' => $state, 'type' => 'disallow', 'content' => $l, 'valid' => false, 'strict' => false );
                                      continue;
                                  }
          Severity: Major
          Found in aioseop_robots.php and 1 other location - About 1 hr to fix
          aioseop_robots.php on lines 263..270

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

          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 4 locations. Consider refactoring.
          Open

                          if ( !empty( $this->options['aiosp_cpostnoydir'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoydir'] ) ) ) {
                              $settings["{$prefix}noydir"]['type'] = 'select';
                              $settings["{$prefix}noydir"]['initial_options'] = Array( '' => __( 'Default - noydir', 'all-in-one-seo-pack' ), 'off' => __( 'ydir', 'all-in-one-seo-pack' ), 'on' => __( 'noydir', 'all-in-one-seo-pack' ) );
                          }
          Severity: Major
          Found in aioseop_class.php and 3 other locations - About 1 hr to fix
          aioseop_class.php on lines 1220..1223
          aioseop_class.php on lines 1224..1227
          aioseop_class.php on lines 1228..1231

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

          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

                              } elseif ( stripos($l, 'allow') === 0) {
                                  if ($state < 3) {
                                      $rules[] = Array( 'state' => $state, 'type' => 'allow', 'content' => $l, 'valid' => false, 'strict' => false );
                                      continue;
                                  }
          Severity: Major
          Found in aioseop_robots.php and 1 other location - About 1 hr to fix
          aioseop_robots.php on lines 256..263

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

          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 4 locations. Consider refactoring.
          Open

                          if ( !empty( $this->options['aiosp_cpostnofollow'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnofollow'] ) ) ) {
                              $settings["{$prefix}nofollow"]['type'] = 'select';
                              $settings["{$prefix}nofollow"]['initial_options'] = Array( '' => __( 'Default - nofollow', 'all-in-one-seo-pack' ), 'off' => __( 'follow', 'all-in-one-seo-pack' ), 'on' => __( 'nofollow', 'all-in-one-seo-pack' ) );
                          }
          Severity: Major
          Found in aioseop_class.php and 3 other locations - About 1 hr to fix
          aioseop_class.php on lines 1220..1223
          aioseop_class.php on lines 1228..1231
          aioseop_class.php on lines 1232..1235

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

          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 4 locations. Consider refactoring.
          Open

                          if ( !empty( $this->options['aiosp_cpostnoodp'] ) && ( in_array( $post_type, $this->options['aiosp_cpostnoodp'] ) ) ) {
                              $settings["{$prefix}noodp"]['type'] = 'select';
                              $settings["{$prefix}noodp"]['initial_options'] = Array( '' => __( 'Default - noodp', 'all-in-one-seo-pack' ), 'off' => __( 'odp', 'all-in-one-seo-pack' ), 'on' => __( 'noodp', 'all-in-one-seo-pack' ) );
                          }
          Severity: Major
          Found in aioseop_class.php and 3 other locations - About 1 hr to fix
          aioseop_class.php on lines 1220..1223
          aioseop_class.php on lines 1224..1227
          aioseop_class.php on lines 1232..1235

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

          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 do_indexed_sitemaps has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function do_indexed_sitemaps() {
                      $this->start_memory_usage = memory_get_peak_usage();
                      $options = $this->options;
                      
                      $this->do_write_sitemap( 'root' );
          Severity: Minor
          Found in aioseop_sitemap.php - About 1 hr to fix

            Method get_option_html has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function get_option_html( $args ) {
                        static $n = 0;
                        extract( $args );
                        if ( $options['type'] == 'custom' )
                            return apply_filters( "{$prefix}output_option", '', $args );                
            Severity: Minor
            Found in aioseop_module_class.php - About 1 hr to fix

              Method filter_options has 44 lines of code (exceeds 25 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 1 hr to fix

                Function get_option_row has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                        function get_option_row( $name, $opts, $args ) {
                            $label_text = $input_attr = $help_text_2 = $id_attr = '';
                            if ( $opts['label'] == 'top' )
                                $align    = 'left';
                            else
                Severity: Minor
                Found in aioseop_module_class.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 aioseop_mrt_pccolumn has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    function aioseop_mrt_pccolumn($aioseopcn, $aioseoppi) {
                        $id = $aioseoppi;
                        $target = null;
                        if( $aioseopcn == 'seotitle' ) $target = 'title';
                        if( $aioseopcn == 'seokeywords' ) $target = 'keywords';
                Severity: Minor
                Found in aioseop_functions.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

                Method annotate_robots has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function annotate_robots( $robots ) {
                                $state = 0;
                                $rules = Array();
                                foreach ($robots as $l) {
                                    $l = trim($l);
                Severity: Minor
                Found in aioseop_robots.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language