84% loyalty-discounts-for-woocommerce

Code Review | Loyalty Discounts for WooCommerce

WordPress plugin Loyalty Discounts for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: loyalty-discounts...
  • Plugin version: 1.2.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-6.2
  • WordPress version: 6.3.1
  • First release: Oct 22, 2018
  • Latest release: Jul 22, 2023
  • Number of updates: 50
  • Update frequency: every 34.7 days
  • Top authors: Elliotvs (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

20+ active /1,642 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
Install script ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼5.06ms] Passed 4 tests

Analyzing server-side resources used by Loyalty Discounts for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.79 ▲0.0642.74 ▼10.56
Dashboard /wp-admin3.63 ▲0.0749.13 ▼4.57
Posts /wp-admin/edit.php3.74 ▲0.0652.97 ▼1.06
Add New Post /wp-admin/post-new.php6.23 ▲0.0898.76 ▼1.83
Media Library /wp-admin/upload.php3.55 ▲0.0638.93 ▼3.26
Woo Loyalty Discounts /wp-admin/options-general.php?page=woo_loyalty_discounts3.5235.56

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 12 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-comments
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Loyalty Discounts for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,799 ▲1314.22 ▼0.341.98 ▼0.3440.81 ▼11.25
Dashboard /wp-admin2,206 ▲265.65 ▼0.0895.33 ▼7.4341.91 ▼1.84
Posts /wp-admin/edit.php2,111 ▲142.09 ▲0.1040.76 ▲4.9935.10 ▲0.07
Add New Post /wp-admin/post-new.php1,533 ▼1223.48 ▲0.15630.40 ▼65.9648.38 ▼8.22
Media Library /wp-admin/upload.php1,408 ▲84.28 ▲0.07100.53 ▼20.8244.12 ▼6.67
Woo Loyalty Discounts /wp-admin/options-general.php?page=woo_loyalty_discounts1,3962.1023.4552.35

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • 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
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 6× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/loyalty-discounts-for-woocommerce/inc/add_discount_total_items_ordered.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/loyalty-discounts-for-woocommerce/inc/add_discount_total_spent.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/loyalty-discounts-for-woocommerce/admin/admin-options.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/loyalty-discounts-for-woocommerce/woo-loyality-discounts.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/loyalty-discounts-for-woocommerce/inc/add_discount_total_cart.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/loyalty-discounts-for-woocommerce/wld-shortcode.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: rules, discounts, rewards, loyalty, woocommerce

loyalty-discounts-for-woocommerce/woo-loyality-discounts.php 85% from 13 tests

"Loyalty Discounts for WooCommerce" version 1.2.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please take the time to fix the following:
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.7" instead of "3.4")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("loyalty-discounts-for-woocommerce.php" instead of "woo-loyality-discounts.php")

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
Success! There were no dangerous files found in this plugin782 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP815193678
CSS23062
JavaScript10342

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions19
▷ Named functions19100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
No PNG files were detected