83% gm-variations-radio-buttons-for-woocommerce

Code Review | GM Variations Radio Buttons for WooCommerce

WordPress plugin GM Variations Radio Buttons for WooCommerce scored 83% from 54 tests.

About plugin

  • Plugin page: gm-variations-rad...
  • Plugin version: 3.0
  • PHP version: 7.4.16
  • WordPress version: 5.8.1
  • First release: Apr 29, 2021
  • Latest release: Apr 29, 2021
  • Number of updates: 2
  • Update frequency: every 1.5 days
  • Top authors: gravitymaster97 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 77 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.04MB] [CPU: ▼142.59ms] Passed 4 tests

An overview of server-side resources used by GM Variations Radio Buttons for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.88 ▲0.0533.81 ▲1.34
Dashboard /wp-admin3.11 ▲0.0551.94 ▲2.07
Posts /wp-admin/edit.php3.16 ▲0.0556.60 ▲8.46
Add New Post /wp-admin/post-new.php5.46 ▲0.0385.98 ▼577.04
Media Library /wp-admin/upload.php3.05 ▲0.0535.79 ▲3.29

Server storage [IO: ▲0.21MB] [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: 17 new files
Database: no new tables, 4 new options
New WordPress options
gmrbw_showdesc
gmrbw_showimg
gmrbw_enable
gmrbw_hide_unpurchase

Browser metrics Passed 4 tests

Checking browser requirements for GM Variations Radio Buttons for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,757 ▲16116.23 ▲0.6612.71 ▲0.8246.91 ▼1.37
Dashboard /wp-admin3,016 ▲856.50 ▲0.28162.27 ▲10.30119.89 ▲18.14
Posts /wp-admin/edit.php2,791 ▲522.77 ▲0.0472.54 ▲8.17106.06 ▲15.23
Add New Post /wp-admin/post-new.php1,704 ▲2118.96 ▲0.20408.18 ▲34.41118.66 ▲9.90
Media Library /wp-admin/upload.php1,859 ▲495.17 ▲0.13144.70 ▼8.38123.17 ▲9.66

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 4 options in the database
    • gmrbw_hide_unpurchase
    • gmrbw_showimg
    • gmrbw_showdesc
    • gmrbw_enable

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)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
The following issues need your attention
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/gm-variations-radio-buttons-for-woocommerce/includes/GMRBW_Radio_Button.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Please fix the following attributes: The official readme.txt is a good inspiration

gm-variations-radio-buttons-for-woocommerce/gm-variations-radio-buttons.php 85% from 13 tests

The main PHP script in "GM Variations Radio Buttons for WooCommerce" version 3.0 is automatically included on every request by WordPress
You should first fix the following items:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("gm-variations-radio-buttons-for-woocommerce.php" instead of "gm-variations-radio-buttons.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected3,447 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript45663802,596
CSS311319575
PHP613923276

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity6.25
▷ Minimum class complexity1.00
▷ Maximum class complexity13.00
Average method complexity2.40
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods15
▷ Static methods00.00%
▷ Public methods15100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.04MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/close_btn.png36.22KB17.59KB▼ 51.42%
assets/js/select2/select2.png0.51KB0.99KB0.00%