peiche/cover

View on GitHub

Showing 17 of 17 total issues

Function exports has 345 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    hub: {
Severity: Major
Found in gruntfile.js - About 1 day to fix

Method cover_customize_register has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function cover_customize_register( $wp_customize ) {
    $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
    $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';

  $wp_customize->add_setting(
Severity: Major
Found in inc/customizer.php - About 5 hrs to fix

File gruntfile.js has 347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
* Cover Gruntfile
* http://eichefam.net/projects/cover
* @author Paul Eiche
*/
Severity: Minor
Found in gruntfile.js - About 4 hrs to fix

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

<?php
/**
 * YARPP Template: Cover Grid (2 across)
 *
 * Description: Related posts template built for the Cover theme. Works best with multiples of two.
Severity: Major
Found in template-parts/yarpp-template-grid-2.php and 1 other location - About 2 hrs to fix
template-parts/yarpp-template-grid-3.php on lines 1..34

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

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

<?php
/**
 * YARPP Template: Cover Grid (3 across)
 *
 * Description: Related posts template built for the Cover theme. Works best with multiples of three.
Severity: Major
Found in template-parts/yarpp-template-grid-3.php and 1 other location - About 2 hrs to fix
template-parts/yarpp-template-grid-2.php on lines 1..34

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

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

Method cover_posted_on has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function cover_posted_on() {

    $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
    if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
        $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
Severity: Minor
Found in inc/template-tags.php - About 1 hr to fix

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

function cover_customize_options() {
  $header_color  = esc_attr( get_theme_mod( 'cover_header_color', '#026ed2' ) );
  $link_color    = esc_attr( get_theme_mod( 'cover_link_color', '#026ed2' ) );
    $overlay_color = esc_attr( get_theme_mod( 'cover_overlay_color', 'overlay-dark' ) );
    $list_style    = esc_attr( get_theme_mod( 'cover_list_style', 'minimal' ) );
Severity: Minor
Found in inc/customizer.php - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

if ( ! ( is_single() || is_page() || is_archive() || is_author() || is_search() || is_404() || ( function_exists( 'cover_has_featured_posts' ) && cover_has_featured_posts() ) ) ) {
    $header_class = ' bg';
}
Severity: Critical
Found in header.php - About 1 hr to fix

Method cover_use_custom_colors has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function cover_use_custom_colors( $colors_css, $color, $contrast ) {
    // Reset colors.
    $colors_css = '';

    $post_id = get_the_ID();
Severity: Minor
Found in inc/color-posts.php - About 1 hr to fix

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

function cover_post_nav() {
    // Don't print empty markup if there's nowhere to navigate.
    $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
    $next = get_adjacent_post( false, '', false );

Severity: Minor
Found in inc/template-tags.php - About 1 hr to fix

Function cover_post_nav has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function cover_post_nav() {
    // Don't print empty markup if there's nowhere to navigate.
    $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
    $next = get_adjacent_post( false, '', false );

Severity: Minor
Found in inc/template-tags.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 cover_posted_on has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function cover_posted_on() {

    $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
    if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
        $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
Severity: Minor
Found in inc/template-tags.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

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

    wp.customize( 'blogname', function( value ) {
        value.bind( function( to ) {
            $( '.site-title' ).text( to );
        } );
    } );
Severity: Minor
Found in assets/js/customizer.js and 1 other location - About 40 mins to fix
assets/js/customizer.js on lines 14..18

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

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

    wp.customize( 'blogdescription', function( value ) {
        value.bind( function( to ) {
            $( '.site-description' ).text( to );
        } );
    } );
Severity: Minor
Found in assets/js/customizer.js and 1 other location - About 40 mins to fix
assets/js/customizer.js on lines 9..13

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

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

<?php
/**
 * YARPP Template: Cover Slider
 *
 * Description: Related posts slider built for the Cover theme.
Severity: Minor
Found in template-parts/yarpp-template-slider.php and 1 other location - About 30 mins to fix
template-parts/yarpp-template-slider-full.php on lines 1..36

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

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

<?php
/**
 * YARPP Template: Cover Full-Width Slider
 *
 * Description: Related posts full-width slider built for the Cover theme.
Severity: Minor
Found in template-parts/yarpp-template-slider-full.php and 1 other location - About 30 mins to fix
template-parts/yarpp-template-slider.php on lines 1..38

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

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

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

function cover_scripts() {

  wp_enqueue_style( 'GoogleFonts', '//fonts.googleapis.com/css?family=Source+Code+Pro|Montserrat|Open+Sans:400,600' );
    wp_enqueue_style( 'cover-style', get_stylesheet_uri() );

Severity: Minor
Found in functions.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

Severity
Category
Status
Source
Language