10% product-country-restrictions

Code Review | Product Country Restrictions

WordPress plugin Product Country Restrictions scored10%from 54 tests.

About plugin

  • Plugin page: product-country-r...
  • Plugin version: 0.4.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.9
  • WordPress version: 6.3.1
  • First release: Sep 21, 2015
  • Latest release: Nov 26, 2017
  • Number of updates: 11
  • Update frequency: every 72.4 days
  • Top authors: Bizilica (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

500+ active /8,302 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
It is recommended to fix the following installer errors
  • The plugin cannot be installed
    • > Error in wp-content/plugins/product-country-restrictions/product-country-restrictions.php+29
    Uncaught Error: Class 'WC_Geolocation' not found in wp-content/plugins/product-country-restrictions/product-country-restrictions.php:29
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): FZ_Product_Country_Restrictions->on_activation()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/includes/plugin.php(693): do_action()

Server metrics [RAM: ▲0.00MB] [CPU: ▼5.06ms] Passed 4 tests

This is a short check of server-side resources used by Product Country Restrictions
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.11 ▼7.01
Dashboard /wp-admin3.31 ▲0.0043.64 ▼0.51
Posts /wp-admin/edit.php3.36 ▲0.0048.40 ▲2.18
Add New Post /wp-admin/post-new.php5.89 ▲0.0083.89 ▼1.81
Media Library /wp-admin/upload.php3.23 ▲0.0032.30 ▼10.92

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 5 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
db_upgraded
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

Product Country Restrictions: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲9013.25 ▼1.151.78 ▼0.8737.72 ▼17.68
Dashboard /wp-admin2,206 ▲155.82 ▼0.03102.56 ▲0.5337.13 ▼3.30
Posts /wp-admin/edit.php2,092 ▲32.04 ▲0.0142.03 ▲7.5240.63 ▲6.28
Add New Post /wp-admin/post-new.php1,533 ▼023.20 ▼0.00671.74 ▲1.9368.31 ▲15.46
Media Library /wp-admin/upload.php1,388 ▲64.23 ▲0.00115.35 ▲4.2652.05 ▲6.30

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
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests Passed 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 Passed 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
Everything seems fine, however this is by no means an exhaustive test

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
1 plugin tags: woocommerce

product-country-restrictions/product-country-restrictions.php 92% from 13 tests

The main file in "Product Country Restrictions" v. 0.4.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Requires at least: Required version does not match the one declared in readme.txt ("4.0" instead of "3.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Success! There were no dangerous files found in this plugin264 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP14611226
PO File1121638

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity33.00
▷ Minimum class complexity33.00
▷ Maximum class complexity33.00
Average method complexity2.68
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods19
▷ Static methods00.00%
▷ Public methods19100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
No PNG files were detected