includes/admin/class-wc-admin-taxonomies.php
File class-wc-admin-taxonomies.php
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Handles taxonomies in admin
*
* @class WC_Admin_Taxonomies
Method add_category_fields
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function add_category_fields() {
?>
<div class="form-field term-display-type-wrap">
<label for="display_type"><?php esc_html_e( 'Display type', 'woocommerce' ); ?></label>
<select id="display_type" name="display_type" class="postform">
Method edit_category_fields
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function edit_category_fields( $term ) {
$display_type = get_term_meta( $term->term_id, 'display_type', true );
$thumbnail_id = absint( get_term_meta( $term->term_id, 'thumbnail_id', true ) );
Function product_cat_column
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function product_cat_column( $columns, $column, $id ) {
if ( 'thumb' === $column ) {
// Prepend tooltip for default category.
$default_category_id = absint( get_option( 'default_product_cat', 0 ) );
- 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"