Showing 3,141 of 4,341 total issues
Function save_variations_data
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
protected function save_variations_data( $product, $request ) {
foreach ( $request['variations'] as $menu_order => $data ) {
$variation = new WC_Product_Variation( isset( $data['id'] ) ? absint( $data['id'] ) : 0 );
// Create initial name and status.
- 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 save_variations_data
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
protected function save_variations_data( $product, $request ) {
foreach ( $request['variations'] as $menu_order => $data ) {
$variation = new WC_Product_Variation( isset( $data['id'] ) ? absint( $data['id'] ) : 0 );
// Create initial name and status.
- 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_scripts
has 337 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function admin_scripts() {
global $wp_query, $post;
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
File class-wc-order-data-store-cpt.php
has 728 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WC_Order_Data_Store_CPT class file.
*
* @package WooCommerce\Classes
WC_Customer
has 88 functions (exceeds 20 allowed). Consider refactoring. Open
class WC_Customer extends WC_Legacy_Customer {
/**
* Stores customer data.
*
File class-wc-shop-customizer.php
has 720 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Adds options to the customizer for WooCommerce.
*
* @version 3.3.0
File class-wc-report-sales-by-date.php
has 719 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WC_Report_Sales_By_Date
*
* @package WooCommerce\Admin\Reports
Function save_variations
has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring. Open
protected function save_variations( $product, $request ) {
global $wpdb;
$id = $product->get_id();
$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 wc-formatting-functions.php
has 712 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce Formatting
*
* Functions for formatting data.
Method output
has 321 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function output( $post ) {
global $theorder;
if ( ! is_object( $theorder ) ) {
$theorder = wc_get_order( $post->ID );
Function wc_save_order_items
has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring. Open
function wc_save_order_items( $order_id, $items ) {
// Allow other plugins to check change in order items before they are saved.
do_action( 'woocommerce_before_save_order_items', $order_id, $items );
$qty_change_order_notes = array();
- 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 woocommerce_form_field
has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring. Open
function woocommerce_form_field( $key, $args, $value = null ) {
$defaults = array(
'type' => 'text',
'label' => '',
'description' => '',
- 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 get_settings
has 309 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_settings( $current_section = '' ) {
$settings = array();
if ( '' === $current_section ) {
$settings = apply_filters(
Function order_pay
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
private static function order_pay( $order_id ) {
do_action( 'before_woocommerce_pay' );
$order_id = absint( $order_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-rest-product-variations-controller.php
has 669 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST API variations controller
*
* Handles requests to the /products/<product_id>/variations endpoints.
File class-wc-tax.php
has 667 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Tax calculation and rate finding class.
*
* @package WooCommerce\Classes
File meta-boxes-product-variation.js
has 666 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global wp, woocommerce_admin_meta_boxes_variations, woocommerce_admin, accounting */
jQuery( function( $ ) {
'use strict';
/**
File class-wc-admin-settings.php
has 663 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce Admin Settings Class
*
* @package WooCommerce\Admin
File photoswipe-ui-default.js
has 656 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*! PhotoSwipe Default UI - 4.1.3 - 2019-01-08
* http://photoswipe.com
* Copyright (c) 2019 Dmitry Semenov; */
/**
*
File class-wc-product-csv-importer.php
has 652 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce Product CSV importer
*
* @package WooCommerce\Import