78% 3-word-address-validation-field

Code Review | what3words Address Field

WordPress plugin what3words Address Field scored 78% from 54 tests.

About plugin

  • Plugin page: 3-word-address-va...
  • Plugin version: 4.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.8
  • WordPress version: 5.8.1
  • First release: Feb 9, 2017
  • Latest release: Nov 17, 2021
  • Number of updates: 120
  • Update frequency: every 14.5 days
  • Top authors: what3words (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

200+ active / 5,066 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

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

Analyzing server-side resources used by what3words Address Field
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.75 ▼0.0916.19 ▼6.15
Dashboard /wp-admin3.08 ▲0.0232.05 ▼3.33
Posts /wp-admin/edit.php3.17 ▲0.0629.76 ▲0.52
Add New Post /wp-admin/post-new.php5.45 ▲0.0169.22 ▼587.09
Media Library /wp-admin/upload.php3.03 ▲0.0324.00 ▲2.27

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 35 new files
Database: no new tables, 1 new option
New WordPress options
w3w_autosuggest_settings

Browser metrics Passed 4 tests

An overview of browser requirements for what3words Address Field
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,878 ▲25116.44 ▲0.818.90 ▲3.6775.82 ▲3.03
Dashboard /wp-admin2,993 ▲976.05 ▼0.10120.19 ▼10.86170.33 ▼2.86
Posts /wp-admin/edit.php2,804 ▲983.26 ▲0.0162.14 ▼3.21135.55 ▲4.44
Add New Post /wp-admin/post-new.php3,737 ▲218.71 ▲0.03455.10 ▲25.14158.49 ▼3.44
Media Library /wp-admin/upload.php1,813 ▲615.54 ▼0.01164.19 ▲20.36186.51 ▲5.75

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin did not uninstall successfully, leaving 1 option in the database
    • w3w_autosuggest_settings

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/3-word-address-validation-field/public/partials/w3w-autosuggest-checkout-page.php
  • 6× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/3-word-address-validation-field/admin/partials/add-address-to-order-page.php:20
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/3-word-address-validation-field/admin/partials/add-admin-notice.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/3-word-address-validation-field/admin/partials/w3w-autosuggest-admin-display.php:15
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/3-word-address-validation-field/admin/partials/w3w-autosuggest-settings.php:5
    • > PHP Notice
      Undefined variable: words in wp-content/plugins/3-word-address-validation-field/admin/partials/add-address-to-order-page.php on line 15
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/3-word-address-validation-field/admin/partials/w3w-autosuggest-advanced.php:18

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 93% 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
9 plugin tags: autosuggest, address, 3 word address, three word address, w3w...

3-word-address-validation-field/w3w-autosuggest.php 85% from 13 tests

The primary PHP file in "what3words Address Field" version 4.0.1 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("3-word-address-validation-field.php" instead of "w3w-autosuggest.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected1,761 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
PHP162406201,244
JavaScript24860368
CSS4162077
SVG22172

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity11.71
▷ Minimum class complexity1.00
▷ Maximum class complexity41.00
Average method complexity3.21
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods34
▷ Static methods25.88%
▷ Public methods2882.35%
▷ Protected methods00.00%
▷ Private methods617.65%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.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
1 PNG file occupies 0.14MB with 0.09MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/img/phone-mockup.png145.85KB55.19KB▼ 62.16%