CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/link-template.php

Summary

Maintainability
F
1 wk
Test Coverage

File link-template.php has 933 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WordPress Link Template Functions
 *
 * @package WordPress
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 2 days to fix

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

    function get_permalink($id = 0, $leavename = false) {
        $rewritecode = array(
            '%year%',
            '%monthnum%',
            '%day%',
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/link-template.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 get_permalink has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function get_permalink($id = 0, $leavename = false) {
        $rewritecode = array(
            '%year%',
            '%monthnum%',
            '%day%',
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 2 hrs to fix

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

      function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $previous = true) {
          global $post, $wpdb;
      
          if ( empty($post) || !is_single() || is_attachment() )
              return null;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/link-template.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_pagenum_link has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function get_pagenum_link($pagenum = 1) {
          global $wp_rewrite;
      
          $pagenum = (int) $pagenum;
      
      
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/link-template.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_adjacent_post has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $previous = true) {
          global $post, $wpdb;
      
          if ( empty($post) || !is_single() || is_attachment() )
              return null;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 1 hr to fix

        Function get_boundary_post has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function get_boundary_post($in_same_cat = false, $excluded_categories = '', $start = true) {
            global $post, $wpdb;
        
            if ( empty($post) || !is_single() || is_attachment() )
                return null;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/link-template.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_attachment_link has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function get_attachment_link($id = false) {
            global $post, $wp_rewrite;
        
            $link = false;
        
        
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/link-template.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_pagenum_link has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function get_pagenum_link($pagenum = 1) {
            global $wp_rewrite;
        
            $pagenum = (int) $pagenum;
        
        
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 1 hr to fix

          Function get_delete_post_link has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function get_delete_post_link($id = 0, $context = 'display') {
              if ( !$post = &get_post( $id ) )
                  return;
          
              if ( 'display' == $context )
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/link-template.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_edit_post_link has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function get_edit_post_link( $id = 0, $context = 'display' ) {
              if ( !$post = &get_post( $id ) )
                  return;
          
              if ( 'display' == $context )
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/link-template.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_edit_post_link has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function get_edit_post_link( $id = 0, $context = 'display' ) {
              if ( !$post = &get_post( $id ) )
                  return;
          
              if ( 'display' == $context )
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 1 hr to fix

            Method get_delete_post_link has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function get_delete_post_link($id = 0, $context = 'display') {
                if ( !$post = &get_post( $id ) )
                    return;
            
                if ( 'display' == $context )
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 1 hr to fix

              Function site_url has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              function site_url($path = '', $scheme = null) {
                  // should the list of allowed schemes be maintained elsewhere?
                  $orig_scheme = $scheme;
                  if ( !in_array($scheme, array('http', 'https')) ) {
                      if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/link-template.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_comments_pagenum_link has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
                  global $post, $wp_rewrite;
              
                  $pagenum = (int) $pagenum;
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/link-template.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 plugins_url has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              function plugins_url($path = '', $plugin = '') {
                  $scheme = ( is_ssl() ? 'https' : 'http' );
              
                  if ( $plugin !== '' && preg_match('#^' . preg_quote(WPMU_PLUGIN_DIR . DIRECTORY_SEPARATOR, '#') . '#', $plugin) ) {
                      $url = WPMU_PLUGIN_URL;
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/link-template.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_feed_link has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              function get_feed_link($feed = '') {
                  global $wp_rewrite;
              
                  $permalink = $wp_rewrite->get_feed_permastruct();
                  if ( '' != $permalink ) {
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/link-template.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_post_comments_feed_link has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              function get_post_comments_feed_link($post_id = '', $feed = '') {
                  global $id;
              
                  if ( empty($post_id) )
                      $post_id = (int) $id;
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 55 mins 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_tag_feed_link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function get_tag_feed_link($tag_id, $feed = '') {
                  $tag_id = (int) $tag_id;
              
                  $tag = get_tag($tag_id);
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 45 mins 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_category_feed_link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function get_category_feed_link($cat_id, $feed = '') {
                  $cat_id = (int) $cat_id;
              
                  $category = get_category($cat_id);
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 45 mins 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 ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
                          $scheme = 'https';
                      elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )
                          $scheme = 'https';
                      elseif ( ('admin' == $scheme) && force_ssl_admin() )
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 40 mins to fix

                Method adjacent_post_link has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 35 mins to fix

                  Function edit_comment_link has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function edit_comment_link( $link = null, $before = '', $after = '' ) {
                      global $comment, $post;
                  
                      if ( $post->post_type == 'page' ) {
                          if ( !current_user_can( 'edit_page', $post->ID ) )
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 35 mins 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

                  Avoid too many return statements within this method.
                  Open

                      return apply_filters( 'get_delete_post_link', wp_nonce_url( admin_url("$file.php?{$action}$var=$post->ID"), "trash-{$file}_" . $post->ID ), $context );
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return apply_filters( 'get_edit_post_link', '', $post->ID, $context );;
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return apply_filters( 'get_delete_post_link', '', $post->ID, $context );;
                      Severity: Major
                      Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return apply_filters('post_link', $permalink, $post, $leavename);
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                              return apply_filters( 'get_edit_post_link', admin_url("$file.php?{$action}$var=$post->ID"), $post->ID, $context );
                          Severity: Major
                          Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 30 mins to fix

                            Function _get_page_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function _get_page_link( $id = false, $leavename = false, $sample = false ) {
                                global $post, $wp_rewrite;
                            
                                if ( !$id )
                                    $id = (int) $post->ID;
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 25 mins 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_next_comments_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function get_next_comments_link( $label = '', $max_page = 0 ) {
                                global $wp_query;
                            
                                if ( !is_singular() || !get_option('page_comments') )
                                    return;
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 25 mins 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_posts_nav_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function get_posts_nav_link( $args = array() ) {
                                global $wp_query;
                            
                                $return = '';
                            
                            
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 25 mins 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_author_feed_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function get_author_feed_link( $author_id, $feed = '' ) {
                                $author_id = (int) $author_id;
                                $permalink_structure = get_option('permalink_structure');
                            
                                if ( empty($feed) )
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 25 mins 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_edit_comment_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function get_edit_comment_link( $comment_id = 0 ) {
                                $comment = &get_comment( $comment_id );
                                $post = &get_post( $comment->comment_post_ID );
                            
                                if ( $post->post_type == 'page' ) {
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 25 mins 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_next_posts_page_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function get_next_posts_page_link($max_page = 0) {
                                global $paged;
                            
                                if ( !is_single() ) {
                                    if ( !$paged )
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 25 mins 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 paginate_comments_links has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function paginate_comments_links($args = array()) {
                                global $wp_query, $wp_rewrite;
                            
                                if ( !is_singular() || !get_option('page_comments') )
                                    return;
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php - About 25 mins 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

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

                                switch ( $post->post_type ) :
                                case 'page' :
                                    if ( !current_user_can( 'edit_page', $post->ID ) )
                                        return;
                                    $file = 'page';
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php and 1 other location - About 5 hrs to fix
                            Web.Admin/2014/wordpress/wp-includes/link-template.php on lines 758..784

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

                            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

                                switch ( $post->post_type ) :
                                case 'page' :
                                    if ( !current_user_can( 'delete_page', $post->ID ) )
                                        return;
                                    $file = 'page';
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php and 1 other location - About 5 hrs to fix
                            Web.Admin/2014/wordpress/wp-includes/link-template.php on lines 682..708

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

                            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 get_search_feed_link($search_query = '', $feed = '') {
                                if ( empty($search_query) )
                                    $search = esc_attr( urlencode(get_search_query()) );
                                else
                                    $search = esc_attr( urlencode(stripslashes($search_query)) );
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php and 1 other location - About 3 hrs to fix
                            Web.Admin/2014/wordpress/wp-includes/link-template.php on lines 645..659

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

                            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 get_search_comments_feed_link($search_query = '', $feed = '') {
                                if ( empty($search_query) )
                                    $search = esc_attr( urlencode(get_search_query()) );
                                else
                                    $search = esc_attr( urlencode(stripslashes($search_query)) );
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php and 1 other location - About 3 hrs to fix
                            Web.Admin/2014/wordpress/wp-includes/link-template.php on lines 620..634

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

                            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 ( '' == $permalink_structure ) {
                                    $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;cat=" . $cat_id;
                                } else {
                                    $link = get_category_link($cat_id);
                                    if( $feed == get_default_feed() )
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php and 1 other location - About 1 hr to fix
                            Web.Admin/2014/wordpress/wp-includes/link-template.php on lines 470..480

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

                            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 ( '' == $permalink_structure ) {
                                    $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;author=" . $author_id;
                                } else {
                                    $link = get_author_posts_url($author_id);
                                    if ( $feed == get_default_feed() )
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-includes/link-template.php and 1 other location - About 1 hr to fix
                            Web.Admin/2014/wordpress/wp-includes/link-template.php on lines 514..524

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

                            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

                            There are no issues that match your filters.

                            Category
                            Status