functions.php
File functions.php
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Strip functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
Method comic_post_type
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function comic_post_type() {
$labels = array(
'name' => _x( 'Comics', 'Post Type General Name', 'strip' ),
'singular_name' => _x( 'Comic', 'Post Type Singular Name', 'strip' ),
Method strip_widgets_init
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function strip_widgets_init() {
register_sidebar(array(
'name' => __( 'Main Sidebar', 'strip' ),
'id' => 'sidebar',
'description' => __( 'The main body widget area', 'strip' ),
Method strip_setup
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function strip_setup() {
/**
* Remove some default WordPress dashboard widgets
* an example custom dashboard widget
* adding custom login css
Method comic_story_taxonomy
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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' ),
Method strip_manage_woocommerce_styles
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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' ) ) {
Function set_default_object_terms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function set_default_object_terms( $post_id, $post ) {
if ( 'publish' === $post->post_status && 'comic' === $post->post_type ) {
$defaults = array(
'story' => array( 'draft' ),
);
- Read upRead up
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
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 );
- Read upRead up
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"