83% woo-phone-validator

Code Review | Phone Validator for WooCommerce

WordPress plugin Phone Validator for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: woo-phone-validator
  • Plugin version: 1.3.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.4
  • WordPress version: 6.3.1
  • First release: Jul 26, 2019
  • Latest release: Aug 1, 2020
  • Number of updates: 14
  • Update frequency: every 27.3 days
  • Top authors: preciousomonze (100%)

Code review

54 tests

User reviews

18 reviews

Install metrics

4,000+ active /14,504 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼5.84ms] Passed 4 tests

Analyzing server-side resources used by Phone Validator for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0336.41 ▼1.09
Dashboard /wp-admin3.33 ▼0.0148.97 ▼5.92
Posts /wp-admin/edit.php3.45 ▲0.0947.33 ▲0.55
Add New Post /wp-admin/post-new.php5.92 ▲0.0394.04 ▼16.88
Media Library /wp-admin/upload.php3.26 ▲0.0334.97 ▲1.13

Server storage [IO: ▲0.69MB] [DB: ▲0.07MB] Passed 3 tests

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

Browser metrics Passed 4 tests

An overview of browser requirements for Phone Validator for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,797 ▲3614.72 ▲0.581.82 ▼0.1940.52 ▼1.35
Dashboard /wp-admin2,203 ▲325.52 ▼0.0485.38 ▼2.9340.95 ▼11.30
Posts /wp-admin/edit.php2,108 ▲52.03 ▲0.0140.90 ▲0.4636.52 ▲2.25
Add New Post /wp-admin/post-new.php1,534 ▲822.77 ▼0.39655.35 ▲46.0356.90 ▼11.46
Media Library /wp-admin/upload.php1,402 ▲54.20 ▼0.0396.99 ▼0.2641.62 ▼1.92

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woo-phone-validator/public/class-woocommerce-account.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woo-phone-validator/public/class-woocommerce-checkout.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that need to be fixed:
  • Screenshots: Add images for these screenshots: #1 (Woocommerce billing phone field includes a flag), #2 (Error shown to user when an invalid phone number is submitted on checkout), #3 (Error shown to user when an invalid phone number is submitted on the billing address edit page)
The official readme.txt might help

woo-phone-validator/wc-pv.php 85% from 13 tests

This is the main PHP file of "Phone Validator for WooCommerce" version 1.3.0, 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:
  • Requires at least: The required version number must match the one declared in readme.txt ("4.9" instead of "5.0")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("woo-phone-validator.php" instead of "wc-pv.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 plugin1,691 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
CSS487936
JavaScript52985493
PHP757210262

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity11.00
▷ Minimum class complexity4.00
▷ Maximum class complexity16.00
Average method complexity2.44
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes125.00%
Methods28
▷ Static methods414.29%
▷ Public methods2589.29%
▷ Protected methods00.00%
▷ Private methods310.71%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants12
▷ Global constants12100.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
5 PNG files occupy 0.31MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/vendor/img/flags.png69.20KB23.42KB▼ 66.16%
assets/vendor/img/flags@2x.png170.28KB68.04KB▼ 60.04%
assets/images/screenshot-1.PNG38.66KB17.76KB▼ 54.07%
assets/images/screenshot-3.png25.08KB11.72KB▼ 53.27%
assets/images/screenshot-2.PNG12.12KB5.91KB▼ 51.22%