83% yith-woocommerce-subscription

Code Review | YITH WooCommerce Subscription

WordPress plugin YITH WooCommerce Subscription scored83%from 54 tests.

About plugin

  • Plugin page: yith-woocommerce-...
  • Plugin version: 3.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 8.1-6.4
  • WordPress version: 6.3.1
  • First release: Nov 24, 2015
  • Latest release: Nov 23, 2023
  • Number of updates: 177
  • Update frequency: every 16.8 days
  • Top authors: yithemes (100%)

Code review

54 tests

User reviews

33 reviews

Install metrics

10,000+ active /414,198 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.05MB] [CPU: ▼10.17ms] Passed 4 tests

An overview of server-side resources used by YITH WooCommerce Subscription
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0736.55 ▼5.62
Dashboard /wp-admin3.37 ▲0.0246.38 ▼13.31
Posts /wp-admin/edit.php3.42 ▲0.0648.37 ▲0.53
Add New Post /wp-admin/post-new.php5.95 ▲0.0683.29 ▼12.55
Media Library /wp-admin/upload.php3.29 ▲0.0535.15 ▼9.19

Server storage [IO: ▲3.93MB] [DB: ▲0.00MB] Passed 3 tests

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 404 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
can_compress_scripts
yit_recently_activated
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by YITH WooCommerce Subscription
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,796 ▲3414.37 ▼0.011.65 ▼0.0639.36 ▼4.52
Dashboard /wp-admin2,204 ▲275.60 ▼0.0493.84 ▼5.7843.78 ▲1.09
Posts /wp-admin/edit.php2,107 ▲71.94 ▼0.0040.47 ▼1.5936.95 ▼0.97
Add New Post /wp-admin/post-new.php1,532 ▲623.06 ▼0.14583.25 ▼39.4156.48 ▼1.08
Media Library /wp-admin/upload.php1,403 ▼04.23 ▼0.01100.22 ▼2.0142.02 ▼0.44

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • The uninstall procedure has failed, leaving 7 options in the database
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • yit_recently_activated
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 5× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Trait 'WooCommerce\\PayPalCommerce\\WcGateway\\Processor\\OrderMetaTrait' not found in wp-content/plugins/yith-woocommerce-subscription/includes/gateways/woocommerce-paypal-payments/module/src/class-ywsbs-wc-paypal-payments-renewal-handler.php on line 32
    • > PHP Fatal error
      Uncaught Error: Interface 'WooCommerce\\PayPalCommerce\\Vendor\\Dhii\\Modular\\Module\\ModuleInterface' not found in wp-content/plugins/yith-woocommerce-subscription/includes/gateways/woocommerce-paypal-payments/module/src/class-ywsbs-wc-paypal-payments-module.php:26
    • > PHP Fatal error
      Trait 'YITH_WC_Subscription_Singleton_Trait' not found in wp-content/plugins/yith-woocommerce-subscription/includes/class.yith-wc-subscription.php on line 16
    • > PHP Fatal error
      Uncaught Error: Class 'WooCommerce\\PayPalCommerce\\Subscription\\Helper\\SubscriptionHelper' not found in wp-content/plugins/yith-woocommerce-subscription/includes/gateways/woocommerce-paypal-payments/module/src/class-ywsbs-wc-paypal-payments-helper.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/yith-woocommerce-subscription/plugin-options/general-options.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
7 plugin tags: subscription box, checkout page, subscription billing, recurring billing, subscription management...

yith-woocommerce-subscription/init.php 77% from 13 tests

The main PHP script in "YITH WooCommerce Subscription" version 3.0.1 is automatically included on every request by WordPress
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("yith-woocommerce-subscription.php" instead of "init.php")
  • Requires at least: The required version number must match the one declared in readme.txt ("6.2" instead of "8.1")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 436 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Good job! No executable or dangerous file extensions detected52,480 lines of code in 349 files:
LanguageFilesBlank linesComment linesLines of code
PHP2044,2818,31521,087
CSS211,95828810,385
JavaScript721,4901,06010,272
PO File61,5661,9204,307
Sass34652153,432
SVG11022,981
XML10016

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 112)
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity39.70
▷ Minimum class complexity1.00
▷ Maximum class complexity336.00
Average method complexity4.08
▷ Minimum method complexity1.00
▷ Maximum method complexity112.00
Code structure
Namespaces0
Interfaces0
Traits1
Classes52
▷ Abstract classes23.85%
▷ Concrete classes5096.15%
▷ Final classes12.00%
Methods654
▷ Static methods8813.46%
▷ Public methods53982.42%
▷ Protected methods8813.46%
▷ Private methods274.13%
Functions190
▷ Named functions17190.00%
▷ Anonymous functions1910.00%
Constants21
▷ Global constants2095.24%
▷ Class constants14.76%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
30 PNG files occupy 0.06MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
plugin-fw/assets/images/ui-icons_454545_256x240.png6.83KB4.17KB▼ 38.86%
plugin-fw/assets/images/sidebar-left.png0.95KB0.11KB▼ 87.91%
plugin-fw/assets/css/jquery-ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.08KB0.17KB0.00%
plugin-fw/assets/css/jquery-ui/images/ui-icons_454545_256x240.png3.69KB4.18KB0.00%
plugin-fw/assets/css/jquery-ui/images/ui-bg_glass_75_e6e6e6_1x400.png0.09KB0.14KB0.00%