SilentComics/Strip

View on GitHub
functions.php

Summary

Maintainability
D
1 day
Test Coverage

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

              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_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

              There are no issues that match your filters.

              Category
              Status