CaffGeek/MBACNationals

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

Summary

Maintainability
F
4 days
Test Coverage

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

<?php
/**
 * Category Template Tags and API.
 *
 * @package WordPress
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/category-template.php - About 7 hrs to fix

    Function get_the_category_list has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    function get_the_category_list( $separator = '', $parents='', $post_id = false ) {
        global $wp_rewrite;
        $categories = get_the_category( $post_id );
        if ( empty( $categories ) )
            return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/category-template.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 wp_generate_tag_cloud has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_generate_tag_cloud( $tags, $args = '' ) {
        global $wp_rewrite;
        $defaults = array(
            'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
            'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/category-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

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

    function wp_list_categories( $args = '' ) {
        $defaults = array(
            'show_option_all' => '', 'orderby' => 'name',
            'order' => 'ASC', 'show_last_update' => 0,
            'style' => 'list', 'show_count' => 0,
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/category-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 wp_generate_tag_cloud has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wp_generate_tag_cloud( $tags, $args = '' ) {
        global $wp_rewrite;
        $defaults = array(
            'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
            'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/category-template.php - About 3 hrs to fix

      Method get_the_category_list has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function get_the_category_list( $separator = '', $parents='', $post_id = false ) {
          global $wp_rewrite;
          $categories = get_the_category( $post_id );
          if ( empty( $categories ) )
              return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/category-template.php - About 2 hrs to fix

        Method wp_list_categories has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function wp_list_categories( $args = '' ) {
            $defaults = array(
                'show_option_all' => '', 'orderby' => 'name',
                'order' => 'ASC', 'show_last_update' => 0,
                'style' => 'list', 'show_count' => 0,
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/category-template.php - About 2 hrs to fix

          Method wp_dropdown_categories has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function wp_dropdown_categories( $args = '' ) {
              $defaults = array(
                  'show_option_all' => '', 'show_option_none' => '',
                  'orderby' => 'id', 'order' => 'ASC',
                  'show_last_update' => 0, 'show_count' => 0,
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/category-template.php - About 1 hr to fix

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

            function wp_dropdown_categories( $args = '' ) {
                $defaults = array(
                    'show_option_all' => '', 'show_option_none' => '',
                    'orderby' => 'id', 'order' => 'ASC',
                    'show_last_update' => 0, 'show_count' => 0,
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/category-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 wp_tag_cloud has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            function wp_tag_cloud( $args = '' ) {
                $defaults = array(
                    'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
                    'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
                    'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/category-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_category_parents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) {
                $chain = '';
                $parent = &get_category( $id );
                if ( is_wp_error( $parent ) )
                    return $parent;
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/category-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

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

            function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/category-template.php - About 35 mins to fix

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

              function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) {
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/category-template.php - About 35 mins to fix

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

                function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/category-template.php - About 35 mins to fix

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

                  function get_category_link( $category_id ) {
                      global $wp_rewrite;
                      $catlink = $wp_rewrite->get_category_permastruct();
                  
                      if ( empty( $catlink ) ) {
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/category-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

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

                  function get_the_terms( $id = 0, $taxonomy ) {
                      global $post;
                  
                       $id = (int) $id;
                  
                  
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/category-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

                                  case 'multiple':
                                      if ( $category->parent )
                                          $thelist .= get_category_parents( $category->parent, true, $separator );
                                      $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '" ' . $rel . '>' . $category->name.'</a></li>';
                                      break;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/category-template.php and 1 other location - About 1 hr to fix
                  Web.Admin/2014/wordpress/wp-includes/category-template.php on lines 213..217

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

                  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

                                  case 'multiple':
                                      if ( $category->parent )
                                          $thelist .= get_category_parents( $category->parent, true, $separator );
                                      $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '" ' . $rel . '>' . $category->cat_name.'</a>';
                                      break;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/category-template.php and 1 other location - About 1 hr to fix
                  Web.Admin/2014/wordpress/wp-includes/category-template.php on lines 190..194

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

                  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 walk_category_tree() {
                      $args = func_get_args();
                      // the user's options are the third parameter
                      if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
                          $walker = new Walker_Category;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/category-template.php and 1 other location - About 1 hr to fix
                  Web.Admin/2014/wordpress/wp-includes/category-template.php on lines 737..746

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

                  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 walk_category_dropdown_tree() {
                      $args = func_get_args();
                      // the user's options are the third parameter
                      if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
                          $walker = new Walker_CategoryDropdown;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/category-template.php and 1 other location - About 1 hr to fix
                  Web.Admin/2014/wordpress/wp-includes/category-template.php on lines 719..728

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

                  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