84% woocommerce-role-pricing

Code Review | Woocommerce Role Pricing

WordPress plugin Woocommerce Role Pricing scored84%from 54 tests.

About plugin

  • Plugin page: woocommerce-role-...
  • Plugin version: 3.5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6-6.2.2
  • WordPress version: 6.3.1
  • First release: Aug 26, 2014
  • Latest release: Jun 21, 2023
  • Number of updates: 49
  • Update frequency: every 65.7 days
  • Top authors: eggemplo (100%)

Code review

54 tests

User reviews

14 reviews

Install metrics

700+ active /34,434 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
The plugin installed gracefully, with no errors

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

An overview of server-side resources used by Woocommerce Role Pricing
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.39 ▲1.28
Dashboard /wp-admin3.31 ▲0.0046.60 ▼1.38
Posts /wp-admin/edit.php3.36 ▲0.0041.60 ▼3.22
Add New Post /wp-admin/post-new.php5.89 ▲0.0079.37 ▼27.12
Media Library /wp-admin/upload.php3.23 ▲0.0032.48 ▼0.61

Server storage [IO: ▲0.37MB] [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: 10 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Woocommerce Role Pricing
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7914.77 ▲0.392.17 ▲0.5045.89 ▲7.17
Dashboard /wp-admin2,206 ▲175.89 ▲0.95113.65 ▲0.1142.06 ▲2.70
Posts /wp-admin/edit.php2,089 ▼32.05 ▼0.0933.69 ▼7.9134.57 ▲0.34
Add New Post /wp-admin/post-new.php1,519 ▼023.09 ▼0.40655.22 ▲61.3750.89 ▲6.00
Media Library /wp-admin/upload.php1,388 ▼04.20 ▼0.0396.61 ▼7.8042.41 ▼2.18

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
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% 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)
Everything seems fine, however this is by no means an exhaustive test

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
Almost there! Just fix the following items
  • 4× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/woocommerce-role-pricing/woocommerce-role-pricing.php:40
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_DIR - assumed 'WP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/woocommerce-role-pricing/woocommerce-role-pricing.php on line 37
    • > PHP Notice
      Trying to get property 'version' of non-object in wp-content/plugins/woocommerce-role-pricing/core/class-woorolepricinglight.php on line 30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/woocommerce-role-pricing/core/class-woorolepricinglight.php:33

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 97% 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
Attributes that require attention:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Settings: Roles - Roles dashboard section.), #3 (Prices - Different prices by user's role.)
The official readme.txt might help

woocommerce-role-pricing/woocommerce-role-pricing.php Passed 13 tests

"Woocommerce Role Pricing" version 3.5.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
51 characters long description:
Shows different prices according to the user's role

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin757 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP3138177658
PO File15912199

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity43.33
▷ Minimum class complexity34.00
▷ Maximum class complexity60.00
Average method complexity5.88
▷ Minimum method complexity1.00
▷ Maximum method complexity30.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods26
▷ Static methods26100.00%
▷ Public methods2492.31%
▷ Protected methods27.69%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
4 PNG files occupy 0.32MB with 0.21MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png60.78KB18.10KB▼ 70.22%
assets/pro_features.png32.32KB9.83KB▼ 69.57%
screenshot-2.png49.85KB14.06KB▼ 71.79%
screenshot-3.png184.39KB84.58KB▼ 54.13%