83% country-code-selector

Code Review | Country Code Selector

WordPress plugin Country Code Selector scored83%from 54 tests.

About plugin

  • Plugin page: country-code-sele...
  • Plugin version: 1.7
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 7.8-6.3
  • WordPress version: 6.3.1
  • First release: Oct 28, 2019
  • Latest release: Jul 26, 2023
  • Number of updates: 33
  • Update frequency: every 41.7 days
  • Top authors: intolap (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

1,000+ active /9,740 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▲1.34ms] Passed 4 tests

An overview of server-side resources used by Country Code Selector
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0342.78 ▲0.93
Dashboard /wp-admin3.33 ▲0.0347.29 ▲3.09
Posts /wp-admin/edit.php3.38 ▲0.0348.14 ▲2.37
Add New Post /wp-admin/post-new.php5.91 ▲0.0388.86 ▲5.23
Media Library /wp-admin/upload.php3.25 ▲0.0334.20 ▼1.02
Country Code Selector /wp-admin/options-general.php?page=country-code-selector3.3333.41

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 38 new files
Database: no new tables, 17 new options
New WordPress options
widget_recent-comments
selected_countries
enable_on_woocommerce
enable_on_shopp
initial_country
widget_recent-posts
enable_on_gform
enable_on_cform7
db_upgraded
theysaidso_admin_options
...

Browser metrics Passed 4 tests

Country Code Selector: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,914 ▲15713.61 ▼0.818.97 ▲6.9137.08 ▼12.02
Dashboard /wp-admin2,210 ▲555.91 ▲0.26100.11 ▲6.1840.44 ▲0.40
Posts /wp-admin/edit.php2,093 ▲42.00 ▼0.0339.26 ▲0.8536.93 ▼1.30
Add New Post /wp-admin/post-new.php1,536 ▲223.32 ▲0.04661.42 ▲16.8265.10 ▲7.40
Media Library /wp-admin/upload.php1,383 ▼24.21 ▼0.03100.00 ▲0.2144.14 ▲0.52
Country Code Selector /wp-admin/options-general.php?page=country-code-selector3,4522.7050.6660.45

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • The uninstall procedure has failed, leaving 17 options in the database
    • enable_on_gform
    • widget_recent-comments
    • enable_on_cform7
    • gform_phone_field_id
    • show_selected
    • selected_cform7
    • widget_recent-posts
    • db_upgraded
    • selected_countries
    • widget_theysaidso_widget
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

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
Please fix the following items
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/country-code-selector/admin/partials/country-code-selector-admin-display.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/country-code-selector/public/partials/country-code-selector-public-display.php:22

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Add images for these screenshots: #1 (admin.png), #2 (woocommerce.png), #3 (gform.png), #4 (cform7.png)
You can take inspiration from this readme.txt

country-code-selector/country-code-selector.php 85% from 13 tests

The main file in "Country Code Selector" v. 1.7 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Description: Please don't use more than 140 characters for the plugin description (currently 184 characters long)
  • Requires at least: Required version must match the one declared in readme.txt ("6.2" instead of "7.8")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected4,619 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript51824722,223
CSS333491,434
PHP12205636716
JSON100246

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity6.00
▷ Minimum class complexity1.00
▷ Maximum class complexity18.00
Average method complexity2.06
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods33
▷ Static methods412.12%
▷ Public methods2884.85%
▷ Protected methods00.00%
▷ Private methods515.15%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
11 PNG files occupy 0.52MB with 0.28MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
cform7.png33.38KB9.82KB▼ 70.60%
admin/images/cf7.png21.22KB7.31KB▼ 65.55%
public/images/flags.png69.20KB23.42KB▼ 66.16%
gform.png47.45KB13.65KB▼ 71.24%
admin/images/gravityforms.png5.87KB6.13KB0.00%