84% woo-price-per-unit

Code Review | WooCommerce Price Per Unit

WordPress plugin WooCommerce Price Per Unit scored84%from 54 tests.

About plugin

  • Plugin page: woo-price-per-unit
  • Plugin version: 2.0.9
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.9.0
  • WordPress version: 6.3.1
  • First release: May 8, 2017
  • Latest release: Feb 1, 2022
  • Number of updates: 96
  • Update frequency: every 18.0 days
  • Top authors: mechuram (100%)

Code review

54 tests

User reviews

10 reviews

Install metrics

1,000+ active /39,749 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.10MB] [CPU: ▼3.57ms] Passed 4 tests

An overview of server-side resources used by WooCommerce Price Per Unit
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.1145.66 ▲1.77
Dashboard /wp-admin3.41 ▲0.0751.70 ▼21.28
Posts /wp-admin/edit.php3.52 ▲0.1758.35 ▲5.74
Add New Post /wp-admin/post-new.php5.99 ▲0.1199.41 ▲6.95
Media Library /wp-admin/upload.php3.33 ▲0.1137.41 ▼0.51

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 15 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by WooCommerce Price Per Unit
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.24 ▼1.386.19 ▲4.4345.08 ▼4.02
Dashboard /wp-admin2,203 ▲125.88 ▲1.00113.99 ▼5.1844.21 ▲1.21
Posts /wp-admin/edit.php2,089 ▼02.02 ▼0.0346.77 ▲4.2038.53 ▲1.02
Add New Post /wp-admin/post-new.php1,533 ▲1923.00 ▲5.25653.26 ▼52.5857.07 ▼3.61
Media Library /wp-admin/upload.php1,382 ▼64.12 ▼0.13113.03 ▼6.9550.52 ▼0.71

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

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
The following issues need your attention
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/woo-price-per-unit/includes/database-upgrade.php:8

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)
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need your attention:
  • Screenshots: Please add an image for screenshot #2 (Single product settings - these settings affect only current product)
The official readme.txt might help

woo-price-per-unit/woo-price-per-unit.php 92% from 13 tests

The principal PHP file in "WooCommerce Price Per Unit" v. 2.0.9 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Requires at least: Required version does not match the one declared in readme.txt ("4.4" instead of "3.0")

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 detected1,385 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP648266927
PO File1153321321
CSS30086
JavaScript10926
XML10025

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.39
Average class complexity138.00
▷ Minimum class complexity138.00
▷ Maximum class complexity138.00
Average method complexity5.62
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods30
▷ Static methods13.33%
▷ Public methods30100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.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
No PNG images were found in this plugin