SilentComics/Strip

View on GitHub

Showing 16 of 16 total issues

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

<?php
/**
 * Template Name: Three columns page
 *
 * The template for displaying comic series archives pages.
Severity: Major
Found in home 3.php and 2 other locations - About 3 days to fix
archive-story.php on lines 1..109
home 4.php on lines 1..109

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

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 3 locations. Consider refactoring.
Open

<?php
/**
 * Template Name: Three Columns Stories Archive
 *
 * The template for displaying comic series archives pages.
Severity: Major
Found in archive-story.php and 2 other locations - About 3 days to fix
home 3.php on lines 1..109
home 4.php on lines 1..109

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

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 3 locations. Consider refactoring.
Open

<?php
/**
 * Template Name: Four columns page
 *
 * The template for displaying comic series archives pages.
Severity: Major
Found in home 4.php and 2 other locations - About 3 days to fix
archive-story.php on lines 1..109
home 3.php on lines 1..109

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

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

File functions.php has 391 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Strip functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
Severity: Minor
Found in functions.php - About 5 hrs to fix

    Method comic_post_type has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function comic_post_type() {
    
        $labels = array(
            'name'                       => _x( 'Comics', 'Post Type General Name', 'strip' ),
            'singular_name'              => _x( 'Comic', 'Post Type Singular Name', 'strip' ),
    Severity: Major
    Found in functions.php - About 2 hrs to fix

      Method strip_widgets_init has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function strip_widgets_init() {
          register_sidebar(array(
              'name'          => __( 'Main Sidebar', 'strip' ),
              'id'            => 'sidebar',
              'description'   => __( 'The main body widget area', 'strip' ),
      Severity: Minor
      Found in functions.php - About 1 hr to fix

        Method strip_setup has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function strip_setup() {
                /**
        * Remove some default WordPress dashboard widgets
        * an example custom dashboard widget
        * adding custom login css
        Severity: Minor
        Found in functions.php - About 1 hr to fix

          Method comic_story_taxonomy has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function comic_story_taxonomy() {
              $labels = array(
                  'name'                       => _x( 'Comic Story', 'Taxonomy General Name', 'strip' ),
                  'singular_name'              => _x( 'Comic Story', 'Taxonomy Singular Name', 'strip' ),
                  'menu_name'                  => __( 'Comic Stories', 'strip' ),
          Severity: Minor
          Found in functions.php - About 1 hr to fix

            Method strip_manage_woocommerce_styles has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function strip_manage_woocommerce_styles() {
                    // remove generator meta tag.
                    remove_action( 'wp_head', array( 'woocommerce', 'generator' ) );
                    // first check that woo exists to prevent fatal errors.
                    if ( function_exists( 'strip_is_woocommerce_activated' ) ) {
            Severity: Minor
            Found in functions.php - About 1 hr to fix

              Method get_comic_boundary_post has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function get_comic_boundary_post( $in_same_term, $start, $taxonomy ) {
                  global $post;
                  setup_postdata( $post );
                  if ( ! taxonomy_exists( $taxonomy ) ) {
                      return null;
              Severity: Minor
              Found in inc/template-tags.php - About 1 hr to fix

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

                    function set_default_object_terms( $post_id, $post ) {
                        if ( 'publish' === $post->post_status && 'comic' === $post->post_type ) {
                            $defaults = array(
                            'story' => array( 'draft' ),
                            );
                Severity: Minor
                Found in functions.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 strip_entry_meta has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    function strip_entry_meta() {
                        if ( is_sticky() && is_home() ) {
                            printf(
                                wp_kses( '<span class="featured-post"><a href="%1$s" title="%2$s" rel="bookmark">Sticky</a></span>', 'strip' ),
                                esc_url( get_permalink() ),
                Severity: Minor
                Found in inc/template-tags.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

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

                    api( "blogname", function( value ) {
                        value.bind( function( to ) {
                            $( "#header h1 a, #footer a.site-name" ).html( to );
                        } );
                    } );
                Severity: Minor
                Found in assets/js/customizer.js and 1 other location - About 30 mins to fix
                assets/js/customizer.js on lines 17..21

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

                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

                    api( "blogdescription", function( value ) {
                        value.bind( function( to ) {
                            $( "#header p.site-description" ).html( to );
                        } );
                    } );
                Severity: Minor
                Found in assets/js/customizer.js and 1 other location - About 30 mins to fix
                assets/js/customizer.js on lines 11..15

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

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

                function strip_header_style() {
                
                    /* Header text color. */
                $header_text_color = get_header_textcolor();
                
                
                Severity: Minor
                Found in inc/custom-header.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 strip_scripts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function strip_scripts() {
                    // add custom font here if any.
                    wp_enqueue_style( 'fenix', get_template_directory_uri() . '/assets/fonts/fenix.css', array(), null );
                
                    wp_enqueue_style( 'inconsolata', get_template_directory_uri() . '/assets/fonts/inconsolata.css', array(), null );
                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