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

View on GitHub

Showing 399 of 427 total issues

File JSON.php has 394 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Converts to and from JSON format.
Severity: Minor
Found in JSON.php - About 5 hrs to fix

    Function parse_annotated_robots has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

            function parse_annotated_robots( $robots ) {
                    $state = 0;
                    $rules = Array();
                    $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
                    $rule = Array();
    Severity: Minor
    Found in aioseop_robots.php - About 5 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_default_values has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_default_values( $defaults, $prefix, &$cache, $item, $nodefaults = false, $type = '' ) {
                if ( !empty( $cache[ $item . $type ] ) ) return $cache[ $item . $type ];
                if ( !empty( $defaults[ $item ] ) ) {
                    $field = $this->prefix . $prefix . $item;
                    if ( $this->option_isset( $prefix . $item ) && $this->options[ $field ] != 'no' ) {
    Severity: Minor
    Found in aioseop_sitemap.php - About 5 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_post_type_data has a Cognitive Complexity of 36 (exceeds 5 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 5 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 oauth_init has 132 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function oauth_init() {
            if ( !is_user_logged_in() || !current_user_can( 'manage_options' ) ) return false;
            $this->token = "anonymous";
            $this->secret = "anonymous";
            $preload = $this->get_class_option();
    Severity: Major
    Found in aioseop_class.php - About 5 hrs to fix

      Function recursive_parse has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

              function recursive_parse( $array ) {
                  $returnArray = array();
                  if (is_array($array)) {
                      foreach ($array as $key => $value) {
                          if (is_array($value)) {
      Severity: Minor
      Found in aioseop_importer_exporter.php - About 5 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_settings has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          function filter_settings( $settings, $location, $current ) {
              if ( $location == null ) {
                  $prefix = $this->prefix;
                  
                  foreach ( Array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt )
      Severity: Minor
      Found in aioseop_class.php - About 5 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 title_placeholder_helper has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) {
              if ( !empty( $post ) )
                  $authordata = get_userdata( $post->post_author );
              else
                  $authordata = new WP_User();
      Severity: Minor
      Found in aioseop_class.php - About 5 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_google_authorship has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          function get_google_authorship( $post ) {
              global $aioseop_options;
              $page = $this->get_page_number();
              // handle authorship
              $googleplus = $publisher = $author = '';
      Severity: Minor
      Found in aioseop_class.php - About 5 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 custom_output_option has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          function custom_output_option( $buf, $args ) {
              if ( $args['name'] == 'aiosp_snippet' )  {
                  $args['options']['type'] = 'html';
                  $args['options']['nowrap'] = false;
                  $args['options']['save'] = false;
      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 convert_case has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

              function convert_case( $str, $mode = 'upper' ) {
                  static $charset = null;
                  if ( $charset == null ) $charset = get_bloginfo( 'charset' );
                  $str = (string)$str;
                  if ( $mode == 'title' ) {
      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 get_addl_pages_only has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

              function get_addl_pages_only() {
                  $pages = Array();
                  if ( !empty( $this->options[ $this->prefix . 'addl_pages' ] ) ) {
                      $siteurl = parse_url( get_home_url() );
                      foreach( $this->options[ $this->prefix . 'addl_pages' ] as $k => $v ) {
      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 encode has 121 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function encode($var)
          {
              switch (gettype($var)) {
                  case 'boolean':
                      return $var ? 'true' : 'false';
      Severity: Major
      Found in JSON.php - About 4 hrs to fix

        File aioseop_robots.php has 367 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          Method aiosp_google_analytics has 120 lines of code (exceeds 25 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: Major
          Found in aioseop_class.php - About 4 hrs to fix

            Function annotate_robots_html has a Cognitive Complexity of 32 (exceeds 5 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 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 wp_head has 118 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function wp_head() {
                        if ( !$this->is_page_included() ) return;
                        $opts = $this->meta_opts;
                        global $wp_query, $aioseop_options, $posts;
                        static $aioseop_dup_counter = 0;
            Severity: Major
            Found in aioseop_class.php - About 4 hrs to fix

              Function annotate_robots has a Cognitive Complexity of 31 (exceeds 5 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 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 help_text_helper has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                      function help_text_helper( &$default_options, $options, $help_link = '' ) {
                          foreach( $options as $o ) {
                              $ht = '';
                              if ( !empty( $this->help_text[$o] ) )
                                  $ht = $this->help_text[$o];
              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 get_option_html has a Cognitive Complexity of 31 (exceeds 5 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 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

              Severity
              Category
              Status
              Source
              Language