82% em-purchase-code-validator

Code Review | EM Purchase Code Validator

WordPress plugin EM Purchase Code Validator scored 82% from 54 tests.

About plugin

  • Plugin page: em-purchase-code-...
  • Plugin version: 1.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.7.2
  • WordPress version: 5.8.1
  • First release: Feb 20, 2019
  • Latest release: May 20, 2021
  • Number of updates: 10
  • Update frequency: every 82.0 days
  • Top authors: codeheaven (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

200+ active / 2,247 total downloads

Benchmarks

Plugin footprint Passed 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: ▼141.71ms] 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 /2.79 ▲0.0721.99 ▼3.50
Dashboard /wp-admin3.13 ▲0.0848.26 ▲5.44
Posts /wp-admin/edit.php3.24 ▲0.1346.57 ▼3.64
Add New Post /wp-admin/post-new.php5.49 ▲0.0595.92 ▼560.13
Media Library /wp-admin/upload.php3.07 ▲0.0737.08 ▲0.44
EM Purchase Code Validator /wp-admin/tools.php?page=em_settings_page3.0431.19

Server storage [IO: ▲0.33MB] [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, no new options

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 /3,842 ▲24616.67 ▲1.0820.86 ▲8.2951.90 ▲0.55
Dashboard /wp-admin2,982 ▲515.91 ▼0.22142.55 ▼27.74117.55 ▼1.21
Posts /wp-admin/edit.php2,748 ▲92.70 ▲0.0167.70 ▼7.3390.33 ▼10.64
Add New Post /wp-admin/post-new.php1,507 ▼17618.43 ▲2.16375.05 ▼29.64114.12 ▼10.37
Media Library /wp-admin/upload.php1,819 ▲95.01 ▲0.01145.19 ▼19.55124.45 ▲0.95
EM Purchase Code Validator /wp-admin/tools.php?page=em_settings_page1,7336.75160.54180.54

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Uninstall script ran successfully

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/tools.php?page=em_settings_page
    • > Notice in wp-content/plugins/em-purchase-code-validator/admin/class-em-puchase-code-validator-admin.php+107
    Trying to access array offset on value of type bool

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:22
    • > 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
    • > Console-api (severe) in unknown
    https://www.facebook.com/rsrc.php/v3/y4/r/GfE1YL8Yl2S.js?_nc_x=Ij3Wp8lg5Kz 57:562 "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.0.4 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • 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")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

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 detected4,733 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript67353683,657
JSON100371
CSS2546366
PHP12142502304
Markdown116035

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.06
Average class complexity1.57
▷ Minimum class complexity1.00
▷ Maximum class complexity3.00
Average method complexity1.13
▷ 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 constants1100.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
There were not PNG files found in your plugin