83% yith-woocommerce-badges-management

Code Review | YITH WooCommerce Badge Management

WordPress plugin YITH WooCommerce Badge Management scored83%from 54 tests.

About plugin

  • Plugin page: yith-woocommerce-...
  • Plugin version: 3.1.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 8.1-6.4
  • WordPress version: 6.3.1
  • First release: Mar 25, 2015
  • Latest release: Nov 20, 2023
  • Number of updates: 217
  • Update frequency: every 14.7 days
  • Top authors: yithemes (100%)

Code review

54 tests

User reviews

89 reviews

Install metrics

20,000+ active /741,683 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼3.98ms] Passed 4 tests

Analyzing server-side resources used by YITH WooCommerce Badge Management
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0136.12 ▼4.57
Dashboard /wp-admin3.31 ▲0.0146.26 ▼5.93
Posts /wp-admin/edit.php3.36 ▲0.0150.34 ▲3.16
Add New Post /wp-admin/post-new.php5.89 ▲0.0196.66 ▼3.02
Media Library /wp-admin/upload.php3.24 ▲0.0138.16 ▼2.41

Server storage [IO: ▲5.05MB] [DB: ▲0.07MB] Passed 3 tests

Filesystem and database footprint
No storage issues were detected
Filesystem: 374 new files
Database: no new tables, 7 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
widget_recent-comments
db_upgraded
yit_recently_activated
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for YITH WooCommerce Badge Management
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,796 ▲914.14 ▼0.181.67 ▼0.4137.32 ▼6.44
Dashboard /wp-admin2,204 ▲275.69 ▲0.1199.11 ▼9.4643.29 ▼0.31
Posts /wp-admin/edit.php2,107 ▲42.00 ▼0.0341.08 ▲1.5736.85 ▼3.45
Add New Post /wp-admin/post-new.php1,536 ▲923.29 ▲0.16679.03 ▲15.6448.12 ▼7.76
Media Library /wp-admin/upload.php1,406 ▲64.24 ▲0.03115.15 ▲1.6349.42 ▲1.54

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • yit_recently_activated
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 16× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/yith-woocommerce-badges-management/views/fields/badge-library.php on line 11
    • > PHP Notice
      Undefined variable: badge in wp-content/plugins/yith-woocommerce-badges-management/views/badge-content.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/yith-woocommerce-badges-management/plugin-options/metaboxes/badge-metabox.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/yith-woocommerce-badges-management/views/metaboxes/badge-settings.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'YITH_WCBM_Simple_Data_Store_CPT' not found in wp-content/plugins/yith-woocommerce-badges-management/includes/data-stores/class-yith-wcbm-badge-data-store-cpt.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/yith-woocommerce-badges-management/views/badges/image.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/yith-woocommerce-badges-management/views/fields/badge-library.php:23
    • > PHP Warning
      current() expects parameter 1 to be array, null given in wp-content/plugins/yith-woocommerce-badges-management/views/fields/badge-library.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/yith-woocommerce-badges-management/plugin-options/metaboxes/product-badge-metabox.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/yith-woocommerce-badges-management/views/badges/text.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
5 plugin tags: woocommerce, badges, products, badge, yith

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

The entry point to "YITH WooCommerce Badge Management" version 3.1.0 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("yith-woocommerce-badges-management.php" instead of "init.php")
  • Requires at least: Required version must be the same as the one declared in readme.txt ("6.2" instead of "8.1")
  • Description: The description should be shorter than 140 characters (currently 214 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Good job! No executable or dangerous file extensions detected57,753 lines of code in 303 files:
LanguageFilesBlank linesComment linesLines of code
PHP1983,2267,13117,861
JSON10010,942
CSS221,82428410,081
JavaScript511,3358289,819
SVG24014,703
PO File61,5661,9204,307
XML112940

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity36.02
▷ Minimum class complexity1.00
▷ Maximum class complexity336.00
Average method complexity3.68
▷ Minimum method complexity1.00
▷ Maximum method complexity42.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes43
▷ Abstract classes24.65%
▷ Concrete classes4195.35%
▷ Final classes00.00%
Methods547
▷ Static methods6511.88%
▷ Public methods45282.63%
▷ Protected methods6712.25%
▷ Private methods285.12%
Functions193
▷ Named functions18495.34%
▷ Anonymous functions94.66%
Constants33
▷ Global constants2781.82%
▷ Class constants618.18%
▷ Public constants6100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
29 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/double-sidebar.png0.95KB0.12KB▼ 87.73%
plugin-fw/assets/images/banner-premium.png10.78KB5.54KB▼ 48.66%
plugin-fw/assets/css/jquery-ui/images/ui-icons_888888_256x240.png3.69KB4.18KB0.00%
plugin-fw/assets/images/ui-icons_222222_256x240.png6.76KB4.17KB▼ 38.24%
plugin-fw/assets/css/jquery-ui/images/ui-icons_454545_256x240.png3.69KB4.18KB0.00%