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

View on GitHub

Showing 399 of 427 total issues

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

        function get_prio_calc( $date, $stats = 0 ) {
            static $cur_time = null;
            if ($cur_time === null) $cur_time = time();
            $time = $cur_time - mysql2date( 'U', $date );
            if ( !empty( $stats ) && isset( $stats['max'] ) && ( $stats['max'] ) ) {
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 filter_options has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    function filter_options( $options, $location ) {
        if ( $location == 'aiosp' ) {
            global $post;
            if ( !empty( $post ) ) {
                $prefix = $this->prefix;
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 output_robots has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        function output_robots($rules) {
            $robots = '';
            foreach ($rules as $r) {
                foreach ( $r['comment']     as $c) $robots .= "$c\n";
                foreach ( $r['user-agent']  as $u) if ( $u != '' ) $robots .= "User-agent: $u\n";
Severity: Minor
Found in aioseop_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

Function __construct has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        function __construct( $mod ) {
            $this->name = __('Feature Manager', 'all-in-one-seo-pack');        // Human-readable name of the plugin
            $this->prefix = 'aiosp_feature_manager_';                        // option prefix
            $this->file = __FILE__;                                    // the current file
            parent::__construct();
Severity: Minor
Found in aioseop_feature_manager.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 do_notify has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        function do_notify() {
            $notify_url = Array(    'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap=', 
                                    'bing' => 'http://www.bing.com/webmaster/ping.aspx?siteMap='
                        );

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

        function do_importer_exporter( ) {
            $submit = null; $count = 0; $post_exists = null; $post_warning = null;
            global $aioseop_options, $aiosp, $aioseop_module_list;
            if ( isset( $_REQUEST['nonce-aioseop'] ) ) $nonce = $_REQUEST['nonce-aioseop'];
            $post_fields = Array( 'keywords', 'description', 'title', 'meta', 'disable', 'disable', 'disable_analytics', 'titleatr', 'menulabel', 'togglekeywords' );
Severity: Major
Found in aioseop_importer_exporter.php - About 3 hrs to fix

    Function get_robot_user_agents has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_robot_user_agents($rules) {
                $opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
                $user_agents = Array();
                foreach ($rules as $r) {
                    if ( !empty( $r['sitemap'] ) && empty( $r['user-agent'] ) ) $r['user-agent'] = Array( null );
    Severity: Minor
    Found in aioseop_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

    Function cf_field_replace has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

            function cf_field_replace( $matches ) {
                $result = '';
                if ( !empty( $matches ) ) {
                    if ( !empty( $matches[1] ) ) {
                        if ( function_exists( 'get_field' ) ) $result = get_field( $matches[1] );
    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 get_sitemap_data has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_sitemap_data( $sitemap_type, $page = 0 ) {
                $sitemap_data = Array();
                if ( $this->options["{$this->prefix}indexes"] ) {
                    $posttypes = $this->options["{$this->prefix}posttypes"];
                    if ( empty( $posttypes ) ) $posttypes = Array();
    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

    File aioseop_module.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    if ( typeof aiosp_data != 'undefined' ) {
        jQuery.each( aiosp_data, function( index, value ) {
    //        aiosp_data[index] = value.json.replace(/"/g, '"');
    //        aiosp_data[index] = jQuery.parseJSON( value );
            if ( index == 0 ) {
    Severity: Minor
    Found in aioseop_module.js - About 3 hrs to fix

      Method get_all_images_by_type has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function get_all_images_by_type( $options = null, $p = null ) {
                  $img = Array();
                  if ( empty( $img ) ) {
                      $size = apply_filters( 'post_thumbnail_size', 'large' );
      
      
      Severity: Major
      Found in aioseop_module_class.php - About 3 hrs to fix

        Function output_sitemap_index has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                function output_sitemap_index( $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: 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 __construct has a Cognitive Complexity of 22 (exceeds 5 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: 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_all_term_counts has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_all_term_counts( $args ) {
                    $term_counts = null;
                    if ( !empty( $args ) && !empty( $args['taxonomy'] ) )
                        if ( !is_array( $args['taxonomy'] ) || ( count( $args['taxonomy'] ) == 1 ) ) {
                            if ( is_array( $args['taxonomy'] ) )
        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_archive_prio_from_posts has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                function get_archive_prio_from_posts( $posts ) {
                    $archives = Array();
                    if ( is_array( $posts ) )
                        foreach( $posts as $p ) {
                            if ( $p->post_type != 'post' ) continue;
        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

        Consider simplifying this complex logical expression.
        Open

                                if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
                                    // found a comma that is not inside a string, array, etc.,
                                    // OR we've reached the end of the character list
                                    $slice = substr($chrs, $top['where'], ($c - $top['where']));
                                    array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
        Severity: Critical
        Found in JSON.php - About 3 hrs to fix

          Method add_page_hooks has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function add_page_hooks() {
          //        $this->oauth_init();
                  $post_objs = get_post_types( '', 'objects' );
                  $pt = array_keys( $post_objs );
                  $rempost = array( 'revision', 'nav_menu_item' );
          Severity: Major
          Found in aioseop_class.php - About 2 hrs to fix

            Method display_extra_metaboxes has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function display_extra_metaboxes( $add, $meta ) {
                    echo "<div class='aioseop_metabox_wrapper' >";
                    switch ( $meta['id'] ) {
                        case "aioseop-about":
                            ?><div class="aioseop_metabox_text">
            Severity: Major
            Found in aioseop_class.php - About 2 hrs to fix

              Function __construct has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                      function __construct( $mod ) {
                          $this->modules['feature_manager'] = null;
                          foreach ( $mod as $m ) $this->modules[$m] = null;
                          $reset = false;
                          $reset_all = ( isset( $_POST['Submit_All_Default'] ) && $_POST['Submit_All_Default']!='' );
              Severity: Minor
              Found in aioseop_module_manager.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 opt_robot_rule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                      function opt_robot_rule($dis) {
                          if ( is_array($dis) ) { // unique rules only
                              $dis = array_unique( $dis, SORT_STRING );
                              $pd = null;
                              foreach( $dis as $k => $d ) { 
              Severity: Minor
              Found in aioseop_robots.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