woothemes/woocommerce

View on GitHub
includes/admin/class-wc-admin-taxonomies.php

Summary

Maintainability
C
1 day
Test Coverage

File class-wc-admin-taxonomies.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Handles taxonomies in admin
 *
 * @class    WC_Admin_Taxonomies
Severity: Minor
Found in includes/admin/class-wc-admin-taxonomies.php - About 3 hrs to fix

    Method add_category_fields has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    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">
    Severity: Major
    Found in includes/admin/class-wc-admin-taxonomies.php - About 2 hrs to fix

      Method edit_category_fields has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      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 ) );
      
      
      Severity: Major
      Found in includes/admin/class-wc-admin-taxonomies.php - About 2 hrs to fix

        Function product_cat_column has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        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 ) );
        
        
        Severity: Minor
        Found in includes/admin/class-wc-admin-taxonomies.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

        There are no issues that match your filters.

        Category
        Status