CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-content/themes/twentyfourteen/inc/featured-content.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method customize_register has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function customize_register( $wp_customize ) {
        $wp_customize->add_section( 'featured_content', array(
            'title'          => __( 'Featured Content', 'twentyfourteen' ),
            'description'    => sprintf( __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
                esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),

    Method get_featured_post_ids has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function get_featured_post_ids() {
            // Return array of cached results if they exist.
            $featured_ids = get_transient( 'featured_content_ids' );
            if ( ! empty( $featured_ids ) ) {
                return array_map( 'absint', (array) $featured_ids );

      Function validate_settings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function validate_settings( $input ) {
              $output = array();
      
              if ( empty( $input['tag-name'] ) ) {
                  $output['tag-id'] = 0;

      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 hide_the_featured_term has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function hide_the_featured_term( $terms, $id, $taxonomy ) {
      
              // This filter is only appropriate on the front-end.
              if ( is_admin() ) {
                  return $terms;

      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 hide_featured_term has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function hide_featured_term( $terms, $taxonomies ) {
      
              // This filter is only appropriate on the front-end.
              if ( is_admin() ) {
                  return $terms;

      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

      There are no issues that match your filters.

      Category
      Status