Showing 3,141 of 4,341 total issues
Function validate_posted_data
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
protected function validate_posted_data( &$data, &$errors ) {
foreach ( $this->get_checkout_fields() as $fieldset_key => $fieldset ) {
$validate_fieldset = true;
if ( $this->maybe_skip_fieldset( $fieldset_key, $data ) ) {
$validate_fieldset = false;
- 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_Admin_Setup_Wizard
has 64 functions (exceeds 20 allowed). Consider refactoring. Open
class WC_Admin_Setup_Wizard {
/**
* Current step
*
Method get_settings
has 233 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_settings() {
$currency_code_options = get_woocommerce_currencies();
foreach ( $currency_code_options as $code => $name ) {
Method get_sales_report
has 233 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_sales_report( $fields = null, $filter = array() ) {
// check user permissions
$check = $this->validate_request();
Method get_item_schema
has 232 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'customer',
'type' => 'object',
File class-wc-post-types.php
has 548 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Post Types
*
* Registers post types and taxonomies.
Function get_orders
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
private static function get_orders() {
$args = array(
'type' => array( 'shop_order', 'shop_order_refund' ),
'limit' => get_option( 'posts_per_page' ),
'paged' => 1,
- 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_Coupon
has 62 functions (exceeds 20 allowed). Consider refactoring. Open
class WC_Coupon extends WC_Legacy_Coupon {
/**
* Data array, with defaults.
*
File class-wc-email.php
has 541 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Class WC_Email file.
*
* @package WooCommerce\Emails
Function expand_data
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
protected function expand_data( $data ) {
$data = apply_filters( 'woocommerce_product_importer_pre_expand_data', $data );
// Images field maps to image and gallery id fields.
if ( isset( $data['images'] ) ) {
- 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 render_helper_output
has 221 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function render_helper_output() {
$auth = WC_Helper_Options::get( 'auth' );
$auth_user_data = WC_Helper_Options::get( 'auth_user_data' );
// Return success/error notices.
Method get_schema
has 220 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function get_schema() {
global $wpdb;
$collate = '';
Method get_item_schema
has 220 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => $this->post_type,
'type' => 'object',
Function save_fields
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
public static function save_fields( $options, $data = null ) {
if ( is_null( $data ) ) {
$data = $_POST; // WPCS: input var okay, CSRF ok.
}
if ( empty( $data ) ) {
- 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-admin-addons.php
has 528 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Addons Page
*
* @package WooCommerce\Admin
File wc-deprecated-functions.php
has 527 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Deprecated functions
*
* Where functions come to die.
Function render_helper_output
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
public static function render_helper_output() {
$auth = WC_Helper_Options::get( 'auth' );
$auth_user_data = WC_Helper_Options::get( 'auth_user_data' );
// Return success/error notices.
- 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_order_report_data
has 214 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_order_report_data( $args = array() ) {
global $wpdb;
$default_args = array(
'data' => array(),
Method get_item_schema
has 214 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'customer',
'type' => 'object',
File jquery.flot.pie.js
has 522 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* Flot plugin for rendering pie charts.
Copyright (c) 2007-2013 IOLA and Ole Laursen.
Licensed under the MIT license.