78% price-per-unit-for-woocommerce

Code Review | Price Per Unit For WooCommerce

WordPress plugin Price Per Unit For WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: price-per-unit-fo...
  • Plugin version: 1.3.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.1.1
  • WordPress version: 6.3.1
  • First release: Nov 13, 2020
  • Latest release: Dec 24, 2022
  • Number of updates: 23
  • Update frequency: every 35.1 days
  • Top authors: apurbajnu (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

80+ active /2,683 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼5.23ms] Passed 4 tests

A check of server-side resources used by Price Per Unit For WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0035.93 ▼7.57
Dashboard /wp-admin3.31 ▲0.0045.45 ▲2.05
Posts /wp-admin/edit.php3.36 ▲0.0045.00 ▼5.31
Add New Post /wp-admin/post-new.php5.89 ▲0.0087.76 ▼7.07
Media Library /wp-admin/upload.php3.23 ▲0.0032.86 ▼0.97

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 39 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Price Per Unit For WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.24 ▼1.201.58 ▼0.1640.08 ▼0.56
Dashboard /wp-admin2,203 ▲154.85 ▼1.01115.89 ▼2.4341.74 ▼3.25
Posts /wp-admin/edit.php2,089 ▲32.05 ▲0.0538.84 ▲3.4935.16 ▲1.67
Add New Post /wp-admin/post-new.php1,533 ▼323.28 ▲0.15627.47 ▼29.7055.02 ▼6.04
Media Library /wp-admin/upload.php1,388 ▼34.23 ▲0.0093.70 ▼8.5842.39 ▼1.30

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 3× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/price-per-unit-for-woocommerce/public/partials/price-per-unit-for-woocommerce-public-display.php
    • > /wp-content/plugins/price-per-unit-for-woocommerce/admin/partials/price-per-unit-for-woocommerce-admin-display.php
    • > /wp-content/plugins/price-per-unit-for-woocommerce/public/partials/svg.php
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/price-per-unit-for-woocommerce/Custom-Metabox/class-ap-custom-metabox-apply.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed:
  • Requires php: Invalid version format
The official readme.txt might help

price-per-unit-for-woocommerce/price-per-unit-for-woocommerce.php Passed 13 tests

This is the main PHP file of "Price Per Unit For WooCommerce" version 1.3.3, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
96 characters long description:
This is a short description of what the plugin does. It's displayed in the WordPress admin area.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin7,396 lines of code in 30 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript101,3881,0354,579
PHP154477691,751
CSS415033927
Markdown1400139

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity19.11
▷ Minimum class complexity1.00
▷ Maximum class complexity89.00
Average method complexity3.51
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods66
▷ Static methods23.03%
▷ Public methods6192.42%
▷ Protected methods00.00%
▷ Private methods57.58%
Functions5
▷ Named functions480.00%
▷ Anonymous functions120.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.10MB with 0.07MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
Custom-Metabox/Screenshot.png103.68KB36.59KB▼ 64.71%