83% loystar-woocommerce-loyalty-program

Code Review | Loystar - Woocommerce Loyalty Program

WordPress plugin Loystar - Woocommerce Loyalty Program scored83%from 54 tests.

About plugin

  • Plugin page: loystar-woocommer...
  • Plugin version: 2.1.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Feb 21, 2019
  • Latest release: Oct 4, 2023
  • Number of updates: 18
  • Update frequency: every 94.1 days
  • Top authors: loystarapp (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /820 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.20MB] [CPU: ▲1.12ms] Passed 4 tests

Analyzing server-side resources used by Loystar - Woocommerce Loyalty Program
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.2041.80 ▲2.49
Dashboard /wp-admin3.51 ▲0.2050.01 ▲0.70
Posts /wp-admin/edit.php3.62 ▲0.2644.58 ▼0.01
Add New Post /wp-admin/post-new.php6.09 ▲0.2097.67 ▲1.28
Media Library /wp-admin/upload.php3.43 ▲0.2035.52 ▲2.92

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 61 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
db_upgraded
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Loystar - Woocommerce Loyalty Program
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,797 ▲3614.16 ▼0.211.75 ▼0.0446.40 ▲8.16
Dashboard /wp-admin2,203 ▲255.60 ▼0.0186.49 ▼27.6138.63 ▼7.26
Posts /wp-admin/edit.php2,108 ▲82.02 ▲0.0333.55 ▼2.0335.72 ▼1.61
Add New Post /wp-admin/post-new.php1,536 ▲823.14 ▲0.02653.46 ▼9.6964.45 ▲17.31
Media Library /wp-admin/upload.php1,411 ▲114.21 ▲0.0695.94 ▼5.0844.22 ▼1.81

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

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
Please take a closer look at the following
  • 18× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_loystar() in wp-content/plugins/loystar-woocommerce-loyalty-program/admin/class-product-page.php:32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_loystar() in wp-content/plugins/loystar-woocommerce-loyalty-program/admin/class-customers.php:72
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_loystar() in wp-content/plugins/loystar-woocommerce-loyalty-program/admin/class-woocommerce-orders.php:56
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_loystar() in wp-content/plugins/loystar-woocommerce-loyalty-program/public/class-loyalty-widget.php:25
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_loystar() in wp-content/plugins/loystar-woocommerce-loyalty-program/admin/class-settings.php:83
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_loystar() in wp-content/plugins/loystar-woocommerce-loyalty-program/admin/class-sync.php:101
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/loystar-woocommerce-loyalty-program/includes/class-loystar-customer-details.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_loystar() in wp-content/plugins/loystar-woocommerce-loyalty-program/public/class-woocommerce-product.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_loystar() in wp-content/plugins/loystar-woocommerce-loyalty-program/admin/class-add-loyalty-program.php:107
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_loystar() in wp-content/plugins/loystar-woocommerce-loyalty-program/admin/class-loyalty-programs.php:82

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)
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
10 plugin tags: customer, loyalty program, ecommerce, food, fashion...

loystar-woocommerce-loyalty-program/loystar.php 77% from 13 tests

The main PHP script in "Loystar - Woocommerce Loyalty Program" version 2.1.1 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 270 characters long)
  • Requires at least: Required version must match the one declared in readme.txt ("4.4" instead of "4.9.0")
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("loystar-woocommerce-loyalty-program.php" instead of "loystar.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Good job! No executable or dangerous file extensions detected6,819 lines of code in 41 files:
LanguageFilesBlank linesComment linesLines of code
PHP234151,9603,745
CSS977592,468
JavaScript738122585
Markdown15017
INI1104

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.35
Average class complexity30.68
▷ Minimum class complexity4.00
▷ Maximum class complexity203.00
Average method complexity3.46
▷ Minimum method complexity1.00
▷ Maximum method complexity42.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes19
▷ Abstract classes00.00%
▷ Concrete classes19100.00%
▷ Final classes15.26%
Methods230
▷ Static methods156.52%
▷ Public methods19886.09%
▷ Protected methods52.17%
▷ Private methods2711.74%
Functions3
▷ Named functions133.33%
▷ Anonymous functions266.67%
Constants27
▷ Global constants27100.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
3 PNG files occupy 0.24MB with 0.14MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/vendor/img/flags@2x.png170.28KB68.04KB▼ 60.04%
assets/images/loystar_logo.png11.25KB5.50KB▼ 51.08%
assets/vendor/img/flags.png69.20KB23.42KB▼ 66.16%