78% em-purchase-code-validator

Code Review | EM Purchase Code Validator

WordPress plugin EM Purchase Code Validator scored78%from 54 tests.

About plugin

  • Plugin page: em-purchase-code-...
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.9
  • WordPress version: 6.3.1
  • First release: Feb 20, 2019
  • Latest release: Feb 11, 2022
  • Number of updates: 16
  • Update frequency: every 67.9 days
  • Top authors: codeheaven (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

200+ active /4,184 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.07MB] [CPU: ▼10.33ms] Passed 4 tests

Analyzing server-side resources used by EM Purchase Code Validator
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0523.58 ▼13.63
Dashboard /wp-admin3.38 ▲0.0445.35 ▼11.78
Posts /wp-admin/edit.php3.50 ▲0.1447.07 ▲0.15
Add New Post /wp-admin/post-new.php5.98 ▲0.1084.34 ▼16.05
Media Library /wp-admin/upload.php3.31 ▲0.0833.90 ▲1.90
EM Purchase Code Validator /wp-admin/tools.php?page=em_settings_page3.2932.32

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

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

Browser metrics Passed 4 tests

EM Purchase Code Validator: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,953 ▲16713.86 ▼0.4916.93 ▲15.0641.36 ▲3.03
Dashboard /wp-admin2,203 ▲235.55 ▼0.0683.08 ▼0.4338.02 ▼4.64
Posts /wp-admin/edit.php2,105 ▲82.01 ▼0.0134.00 ▼0.7335.61 ▼4.30
Add New Post /wp-admin/post-new.php1,533 ▼322.96 ▲4.59645.45 ▲11.8458.92 ▼2.60
Media Library /wp-admin/upload.php1,411 ▲114.21 ▼0.02101.75 ▲8.3046.01 ▲4.33
EM Purchase Code Validator /wp-admin/tools.php?page=em_settings_page1,4777.31177.1991.95

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded

Smoke tests 50% 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 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/em-purchase-code-validator/admin/partials/em-puchase-code-validator-admin-display.php:23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/em-purchase-code-validator/public/partials/em-puchase-code-validator-public-display.php:59

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following user-side errors
    • > GET request to /wp-admin/tools.php?page=em_settings_page
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.
    • > GET request to /wp-admin/tools.php?page=em_settings_page
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'bluetooth'.
    • > GET request to /wp-admin/tools.php?page=em_settings_page
    • > Deprecation (warning) in unknown
    https://static.xx.fbcdn.net/rsrc.php/v3/yQ/r/bnRvNSHX7Ev.js?_nc_x=Ij3Wp8lg5Kz 275 Listener added for a synchronous 'DOMSubtreeModified' DOM Mutation Event. This event type is deprecated (https://w3c.github.io/uievents/#legacy-event-types) and work is underway to remove it from this browser. Usage of this event listener will cause performance issues today, and represents a risk of future incompatibility. Consider using MutationObserver instead.
    • > GET request to /wp-admin/tools.php?page=em_settings_page
    • > Console-api (severe) in unknown
    https://static.xx.fbcdn.net/rsrc.php/v3/yQ/r/bnRvNSHX7Ev.js?_nc_x=Ij3Wp8lg5Kz 60:573 "ErrorUtils caught an error:\n\nCannot listen to an undefined element. [Caught in: Tried to listen to element of type click]\n\nSubsequent non-fatal errors won't be logged; see https://fburl.com/debugjs."

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that require attention:
  • Plugin Name: You should set the name of your plugin on the first line ( === em-purchase-code-validator === )
The official readme.txt is a good inspiration

em-purchase-code-validator/em-puchase-code-validator.php 85% from 13 tests

The main PHP file in "EM Purchase Code Validator" ver. 1.1 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: The principal plugin file should be the same as the plugin slug ("em-purchase-code-validator.php" instead of "em-puchase-code-validator.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
No dangerous file extensions were detected1,209 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
JSON100371
CSS2546366
PHP12142502320
JavaScript6536112
Markdown118040

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.07
Average class complexity1.86
▷ Minimum class complexity1.00
▷ Maximum class complexity4.00
Average method complexity1.19
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods31
▷ Static methods26.45%
▷ Public methods2683.87%
▷ Protected methods00.00%
▷ Private methods516.13%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There were not PNG files found in your plugin