includes/admin/class-wc-admin-assets.php
Method admin_scripts
has 337 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function admin_scripts() {
global $wp_query, $post;
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
Function admin_scripts
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
Open
public function admin_scripts() {
global $wp_query, $post;
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
- 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
File class-wc-admin-assets.php
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Load assets
*
* @package WooCommerce\Admin
Function admin_styles
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
public function admin_styles() {
global $wp_scripts;
$version = Constants::get_constant( 'WC_VERSION' );
$screen = get_current_screen();
- 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
Method admin_styles
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function admin_styles() {
global $wp_scripts;
$version = Constants::get_constant( 'WC_VERSION' );
$screen = get_current_screen();
Avoid deeply nested control flow statements. Open
Open
if ( ! $order->has_status( array( 'pending', 'failed', 'cancelled' ) ) ) {
$remove_item_notice = $remove_item_notice . ' ' . __( "You may need to manually restore the item's stock.", 'woocommerce' );
}