83% woo-cart-weight

Code Review | Cart Weight for WooCommerce

WordPress plugin Cart Weight for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: woo-cart-weight
  • Plugin version: 1.8.0
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.8-6.4
  • WordPress version: 6.3.1
  • First release: Aug 11, 2015
  • Latest release: Nov 23, 2023
  • Number of updates: 135
  • Update frequency: every 22.4 days
  • Top authors: wpdesk (51.11%)octolize (37.78%)jablonowski (12.59%)

Code review

54 tests

User reviews

10 reviews

Install metrics

2,000+ active /60,775 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.45MB] [CPU: ▼2.19ms] Passed 4 tests

Analyzing server-side resources used by Cart Weight for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.92 ▲0.4639.78 ▼1.30
Dashboard /wp-admin3.75 ▲0.4548.80 ▼1.03
Posts /wp-admin/edit.php3.80 ▲0.4549.39 ▲2.82
Add New Post /wp-admin/post-new.php6.33 ▲0.4589.46 ▼9.25
Media Library /wp-admin/upload.php3.68 ▲0.4537.98 ▲3.16

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 410 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts
plugin_activation_woo-cart-weight/woocommerce-cart-weight.php
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Cart Weight for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲614.32 ▼0.031.71 ▼0.2137.01 ▼6.47
Dashboard /wp-admin2,195 ▲155.49 ▼0.1788.89 ▼2.6340.08 ▼0.22
Posts /wp-admin/edit.php2,103 ▲31.95 ▼0.0240.68 ▲0.7336.18 ▼2.96
Add New Post /wp-admin/post-new.php1,537 ▲224.91 ▼0.46615.45 ▼24.4963.59 ▲2.11
Media Library /wp-admin/upload.php1,397 ▼34.26 ▲0.0997.23 ▼8.0440.46 ▼3.62

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • plugin_activation_woo-cart-weight/woocommerce-cart-weight.php
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 171× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WCWeightVendor\\Monolog\\Handler\\Handler' not found in wp-content/plugins/woo-cart-weight/vendor_prefixed/monolog/monolog/src/Monolog/Handler/AbstractHandler.php:25
    • > PHP Fatal error
      Uncaught Error: Interface 'WCWeightVendor\\WPDesk\\View\\Renderer\\Renderer' not found in wp-content/plugins/woo-cart-weight/vendor_prefixed/wpdesk/wp-view/src/Renderer/LoadTemplatePlugin.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'WCWeightVendor\\Monolog\\Handler\\SocketHandler' not found in wp-content/plugins/woo-cart-weight/vendor_prefixed/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php:32
    • > PHP Fatal error
      Uncaught Error: Interface 'WCWeightVendor\\WPDesk\\Plugin\\Flow\\Initialization\\InitializationStrategy' not found in wp-content/plugins/woo-cart-weight/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/Simple/SimplePaidStrategy.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'WCWeightVendor\\Monolog\\Processor\\ProcessorInterface' not found in wp-content/plugins/woo-cart-weight/vendor_prefixed/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/woo-cart-weight/vendor_prefixed/octolize/wp-octolize-tracker/src/OptInNotice/views/html-notice.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'WCWeightVendor\\Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/woo-cart-weight/vendor_prefixed/wpdesk/wp-logs/src/WC/WooCommerceHandler.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WCWeightVendor\\Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/woo-cart-weight/vendor_prefixed/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'WCWeightVendor\\Monolog\\Handler\\Handler' not found in wp-content/plugins/woo-cart-weight/vendor_prefixed/monolog/monolog/src/Monolog/Handler/NullHandler.php:27
    • > PHP Fatal error
      Uncaught Error: Interface 'WCWeightVendor\\WPDesk\\PluginBuilder\\Storage\\PluginStorage' not found in wp-content/plugins/woo-cart-weight/vendor_prefixed/wpdesk/wp-builder/src/Storage/StaticStorage.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

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
6 plugin tags: weight, order total weight, woocommerce cart weight, cart, order weight...

woo-cart-weight/woocommerce-cart-weight.php 77% from 13 tests

"Cart Weight for WooCommerce" version 1.8.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Requires PHP: Required version must be the same as the one declared in readme.txt ("7.2" instead of "7.4")
  • Main file name: Name the main plugin file the same as the plugin slug ("woo-cart-weight.php" instead of "woocommerce-cart-weight.php")
  • Requires at least: Required version must be the same as the one declared in readme.txt ("4.5" instead of "5.8")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
There were no executable files found in this plugin16,118 lines of code in 395 files:
LanguageFilesBlank linesComment linesLines of code
PHP33986211,13614,648
JSON23001,052
SVG2000157
JavaScript752152
CSS420284
Markdown25025

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity5.87
▷ Minimum class complexity1.00
▷ Maximum class complexity79.00
Average method complexity2.23
▷ Minimum method complexity1.00
▷ Maximum method complexity22.00
Code structure
Namespaces51
Interfaces63
Traits12
Classes233
▷ Abstract classes125.15%
▷ Concrete classes22194.85%
▷ Final classes62.71%
Methods1,367
▷ Static methods977.10%
▷ Public methods1,03675.79%
▷ Protected methods18513.53%
▷ Private methods14610.68%
Functions52
▷ Named functions1426.92%
▷ Anonymous functions3873.08%
Constants152
▷ Global constants21.32%
▷ Class constants15098.68%
▷ Public constants11476.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
6 compressed PNG files occupy 0.10MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/assets/images/wpdesk.net.png2.36KB2.43KB0.00%
vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/assets/images/logo.png2.36KB2.43KB0.00%
vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/assets/images/wpdesk.pl.png2.36KB2.43KB0.00%
vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/assets/images/octolize.com.png88.91KB39.07KB▼ 56.06%
vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/assets/images/logo@2x.png4.17KB4.47KB0.00%