Showing 3,141 of 4,341 total issues
File jquery.qrcode.js
has 915 lines of code (exceeds 250 allowed). Consider refactoring. Open
//---------------------------------------------------------------------
// QRCode for JavaScript
//
// Copyright (c) 2009 Kazuhiko Arase
//
Function set_product_meta
has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring. Open
protected function set_product_meta( $product, $request ) {
// Virtual.
if ( isset( $request['virtual'] ) ) {
$product->set_virtual( $request['virtual'] );
}
- 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 set_product_meta
has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring. Open
protected function set_product_meta( $product, $request ) {
// Virtual.
if ( isset( $request['virtual'] ) ) {
$product->set_virtual( $request['virtual'] );
}
- 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
WC_Cart
has 110 functions (exceeds 20 allowed). Consider refactoring. Open
class WC_Cart extends WC_Legacy_Cart {
/**
* Contains an array of cart items.
*
Method output_fields
has 417 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function output_fields( $options ) {
foreach ( $options as $value ) {
if ( ! isset( $value['type'] ) ) {
continue;
}
Function setup
has 414 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setup($) {
$.fn._fadeIn = $.fn.fadeIn;
var noOp = $.noop || function() {};
Function nfx
has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring. Open
private static function nfx( $expr ) {
$index = 0;
$stack = new WC_Eval_Math_Stack;
$output = array(); // postfix form of expression, to be passed to pfx()
- 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 abstract-wc-product.php
has 794 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce product base class.
*
* @package WooCommerce\Abstracts
WC_Abstract_Order
has 98 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
use WC_Item_Totals;
/**
* Order Data array. This is the core order data exposed in APIs since 3.0.0.
Function output
has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring. Open
public static function output( $post ) {
global $theorder;
if ( ! is_object( $theorder ) ) {
$theorder = wc_get_order( $post->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-reviews-controller.php
has 765 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST API Product Reviews Controller
*
* Handles requests to /products/reviews.
File class-wc-rest-product-variations-v2-controller.php
has 753 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-form-handler.php
has 747 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Handle frontend forms.
*
* @package WooCommerce\Classes\
Method query_report_data
has 347 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function query_report_data() {
$this->report_data = new stdClass();
$this->report_data->order_counts = (array) $this->get_order_report_data(
array(
Method get_item_schema
has 347 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_item_schema() {
$weight_unit = get_option( 'woocommerce_weight_unit' );
$dimension_unit = get_option( 'woocommerce_dimension_unit' );
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
File class-wc-checkout.php
has 744 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Checkout functionality
*
* The WooCommerce checkout class handles the checkout process, collecting user data and processing the payment.
Method get_item_schema
has 344 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_item_schema() {
$weight_unit = get_option( 'woocommerce_weight_unit' );
$dimension_unit = get_option( 'woocommerce_dimension_unit' );
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
Function save_variations
has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring. Open
protected function save_variations( $product, $request ) {
global $wpdb;
$id = $product->get_id();
$variations = $request['variations'];
- 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
WC_AJAX
has 90 functions (exceeds 20 allowed). Consider refactoring. Open
class WC_AJAX {
/**
* Hook in ajax handlers.
*/
Method get_settings
has 341 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_settings( $current_section = '' ) {
if ( 'inventory' === $current_section ) {
$settings = apply_filters(
'woocommerce_inventory_settings',
array(