Showing 3,141 of 4,341 total issues
WC_API_Products
has 59 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class WC_API_Products extends WC_API_Resource {
/** @var string $base the route base */
protected $base = '/products';
Function save_address
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function save_address() {
global $wp;
$nonce_value = wc_get_var( $_REQUEST['woocommerce-edit-address-nonce'], wc_get_var( $_REQUEST['_wpnonce'], '' ) ); // @codingStandardsIgnoreLine.
- 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 register_taxonomies
has 210 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function register_taxonomies() {
if ( ! is_blog_installed() ) {
return;
}
File wc-user-functions.php
has 516 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* WooCommerce Customer Functions
*
* Functions for customers.
File abstract-wc-settings-api.php
has 514 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Abstract Settings API Class
*
* Admin Settings API used by Integrations, Shipping Methods, and Payment Gateways.
File meta-boxes-product.js
has 511 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*global woocommerce_admin_meta_boxes */
jQuery( function( $ ) {
// Scroll to first checked category
// https://github.com/scribu/wp-category-checklist-tree/blob/d1c3c1f449e1144542efa17dde84a9f52ade1739/category-checklist-tree.php
Function set_product_data
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function set_product_data( &$product, $data ) {
if ( isset( $data['raw_attributes'] ) ) {
$attributes = array();
$default_attributes = array();
$existing_attributes = $product->get_attributes();
- 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-discounts.php
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Discount calculation
*
* @package WooCommerce\Classes
File class-wc-query.php
has 508 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Contains the query functions for WooCommerce which alter the front-end post queries and loops
*
* @version 3.2.0
File class-wc-report-sales-by-product.php
has 507 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Sales By Product Reporting
*
* @package WooCommerce\Admin\Reporting
File class-wc-rest-terms-controller.php
has 507 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Abstract Rest Terms Controller
*
* @package WooCommerce\RestApi
Method get_main_chart
has 203 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_main_chart() {
global $wp_locale;
// Prepare data for report.
$data = array(
Method get_wp_query_args
has 202 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function get_wp_query_args( $query_vars ) {
// Map query vars to ones that get_wp_query_args or WP_Query recognize.
$key_mapping = array(
'status' => 'post_status',
Method get_product_data
has 202 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function get_product_data( $product, $context = 'view' ) {
/*
* @param WP_REST_Request $request Current request object. For backward compatibility, we pass this argument silently.
*
* TODO: Refactor to fix this behavior when DI gets included to make it obvious and clean.
File class-wc-meta-box-order-data.php
has 498 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Order Data
*
* Functions for displaying the order data meta box.
File class-wc-coupon.php
has 496 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* WooCommerce coupons.
*
* The WooCommerce coupons class gets coupon data from storage and checks coupon validity.
Method set_product_meta
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function set_product_meta( $product, $request ) {
// Virtual.
if ( isset( $request['virtual'] ) ) {
$product->set_virtual( $request['virtual'] );
}
Method set_product_meta
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function set_product_meta( $product, $request ) {
// Virtual.
if ( isset( $request['virtual'] ) ) {
$product->set_virtual( $request['virtual'] );
}
File class-wc-admin-report.php
has 492 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
File class-wc-webhook.php
has 491 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Webhook
*
* This class handles storing and retrieving webhook data from the associated.