Showing 3,141 of 4,341 total issues
Method get_item_schema
has 844 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',
Method get_item_schema
has 832 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 wc-update-functions.php
has 1486 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce Updates
*
* Functions for updating data, used by the background updater.
File class-wc-geo-ip.php
has 1478 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Geo IP class
*
* This class is a fork of GeoIP class from MaxMind LLC.
File wc-core-functions.php
has 1477 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce Core Functions
*
* General core functions available on both the front-end and admin.
File class-wc-api-products.php
has 1435 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WooCommerce API Products Class
*
* Handles requests to the /products endpoint
File class-wc-rest-orders-v2-controller.php
has 1434 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST API Orders controller
*
* Handles requests to the /orders endpoint.
File jquery.zeroclipboard.js
has 1417 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* jquery.zeroclipboard
* Bind to the `beforecopy`, `copy`, `aftercopy`, and `copy-error` events, custom DOM-like events for clipboard injection generated using jQuery's Special Events API and ZeroClipboard's Core module.
* Copyright (c) 2014
* Licensed MIT
File class-wc-product-data-store-cpt.php
has 1385 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WC_Product_Data_Store_CPT class file.
*
* @package WooCommerce\Classes
Method get_item_schema
has 675 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',
File class-wc-rest-orders-v1-controller.php
has 1259 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST API Orders controller
*
* Handles requests to the /orders endpoint.
Method get_country_locale
has 649 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_country_locale() {
if ( empty( $this->locale ) ) {
$this->locale = apply_filters(
'woocommerce_get_country_locale',
array(
Function PhotoSwipeUI_Default
has 641 lines of code (exceeds 25 allowed). Consider refactoring. Open
function(pswp, framework) {
var ui = this;
var _overlayUIUpdated = false,
_controlsVisible = true,
File meta-boxes-order.js
has 1228 lines of code (exceeds 250 allowed). Consider refactoring. Open
// eslint-disable-next-line max-len
/*global woocommerce_admin_meta_boxes, woocommerce_admin, accounting, woocommerce_admin_meta_boxes_order, wcSetClipboard, wcClearClipboard */
jQuery( function ( $ ) {
// Stand-in wcTracks.recordEvent in case tracks is not available (for any reason).
WC_Product
has 158 functions (exceeds 20 allowed). Consider refactoring. Open
class WC_Product extends WC_Abstract_Legacy_Product {
/**
* This is the name of this object type.
*
Function prepare_object_for_database
has a Cognitive Complexity of 153 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_object_for_database( $request, $creating = false ) {
$id = isset( $request['id'] ) ? absint( $request['id'] ) : 0;
// Type is the most important part here because we need to be using the correct class and methods.
if ( isset( $request['type'] ) ) {
- 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_item_schema
has 608 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#',
Method get_item_schema
has 603 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_product_meta
has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring. Open
protected function save_product_meta( $product, $data ) {
global $wpdb;
// Virtual.
if ( isset( $data['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 save_product_meta
has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring. Open
protected function save_product_meta( $product, $data ) {
global $wpdb;
// Virtual
if ( isset( $data['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"