84% loyaltyjs

Code Review | Loyalty.js

WordPress plugin Loyalty.js scored84%from 54 tests.

About plugin

  • Plugin page: loyaltyjs
  • Plugin version: 2.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.1
  • WordPress version: 6.3.1
  • First release: Oct 28, 2014
  • Latest release: Jan 26, 2015
  • Number of updates: 31
  • Update frequency: every 2.9 days
  • Top authors: eisenivan (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

10+ active /909 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼5.08ms] Passed 4 tests

A check of server-side resources used by Loyalty.js
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0139.90 ▼5.53
Dashboard /wp-admin3.32 ▲0.0148.75 ▼10.50
Posts /wp-admin/edit.php3.37 ▲0.0147.30 ▲1.57
Add New Post /wp-admin/post-new.php5.90 ▲0.0187.63 ▼5.84
Media Library /wp-admin/upload.php3.24 ▲0.0136.59 ▲2.09
Loyalty.js /wp-admin/options-general.php?page=loyalty_js_options3.2232.89

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Loyalty.js
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,886 ▲10013.44 ▼0.8511.17 ▲9.2842.59 ▲1.28
Dashboard /wp-admin2,199 ▲195.60 ▼0.0786.73 ▼18.4938.61 ▼7.61
Posts /wp-admin/edit.php2,107 ▲71.99 ▼0.0238.73 ▲2.6834.12 ▼3.67
Add New Post /wp-admin/post-new.php1,548 ▲323.37 ▲0.00609.78 ▲2.7963.20 ▲8.83
Media Library /wp-admin/upload.php1,401 ▼24.24 ▲0.02103.18 ▼2.0548.42 ▲1.78
Loyalty.js /wp-admin/options-general.php?page=loyalty_js_options9112.0124.2838.16

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/loyaltyjs/loyalty-js.php:72
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/loyaltyjs/loyalty-js-admin.php:20

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
6 plugin tags: business logic, customer loyalty, view count, jquery, user rewards...

loyaltyjs/loyalty-js.php 92% from 13 tests

This is the main PHP file of "Loyalty.js" version 2.0.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("loyaltyjs.php" instead of "loyalty-js.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin142 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP33520133
JavaScript2189

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.21
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%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
There were not PNG files found in your plugin