73% woo-country-restrictions-advanced

Code Review | WooCommerce Country Catalogs - Product Country Restrictions

WordPress plugin WooCommerce Country Catalogs - Product Country Restrictions scored 73% from 54 tests.

About plugin

  • Plugin page: woo-country-restr...
  • Plugin version: 1.14.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2
  • WordPress version: 6.3.1
  • First release: Sep 10, 2018
  • Latest release: Jul 5, 2023
  • Number of updates: 76
  • Update frequency: every 23.1 days
  • Top authors: JoseVega (100%)

Code review

54 tests

User reviews

15 reviews

Install metrics

400+ active / 17,215 total downloads

Benchmarks

Plugin footprint 65% 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: ▲5.05MB] [CPU: ▲21.95ms] 75% from 4 tests

Analyzing server-side resources used by WooCommerce Country Catalogs - Product Country Restrictions
Please fix the following
  • Extra RAM: Extra memory usage should kept under 5MB (currently 5.05MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /8.93 ▲5.4755.24 ▲16.18
Dashboard /wp-admin8.95 ▲5.6474.55 ▲23.92
Posts /wp-admin/edit.php8.95 ▲5.5978.55 ▲30.17
Add New Post /wp-admin/post-new.php9.38 ▲3.49113.78 ▲17.52
Media Library /wp-admin/upload.php8.95 ▲5.7269.17 ▲33.26
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius8.9559.87

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 202 new files
Database: no new tables, 10 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
fs_accounts
widget_recent-posts
widget_recent-comments
fs_active_plugins
can_compress_scripts
db_upgraded
fs_debug_mode
wcacr_welcome_redirect

Browser metrics Passed 4 tests

This is an overview of browser requirements for WooCommerce Country Catalogs - Product Country Restrictions
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,516 ▼21914.47 ▼0.270.83 ▼0.934.54 ▼42.90
Dashboard /wp-admin2,240 ▲524.83 ▼0.05108.16 ▲4.4240.14 ▲0.34
Posts /wp-admin/edit.php2,123 ▲342.00 ▼0.0035.35 ▼4.7632.37 ▼4.63
Add New Post /wp-admin/post-new.php1,532 ▲917.39 ▼5.80653.14 ▲14.2164.51 ▲8.10
Media Library /wp-admin/upload.php1,425 ▲344.15 ▼0.0998.75 ▼0.5546.25 ▲3.52
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,0971.8527.2627.98

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/woo-country-restrictions-advanced/vendor/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • This plugin does not fully uninstall, leaving 10 options in the database
    • widget_recent-comments
    • fs_debug_mode
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • fs_active_plugins
    • fs_accounts
    • wcacr_welcome_redirect

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 19× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Warning
      require_once(WCACR_DIST_DIR/vendor/freemius/start.php): failed to open stream: No such file or directory in wp-content/plugins/woo-country-restrictions-advanced/inc/freemius-init.php on line 16
    • > PHP Warning
      include(WCACR_DIST_DIR/views/action-buttons.php): failed to open stream: No such file or directory in wp-content/plugins/woo-country-restrictions-advanced/views/welcome-page-content.php on line 3
    • > PHP Warning
      Use of undefined constant WCACR_DIST_DIR - assumed 'WCACR_DIST_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/woo-country-restrictions-advanced/inc/freemius-init.php on line 16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/woo-country-restrictions-advanced/modules/core/frontend/product-frontend-functions.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woo-country-restrictions-advanced/integrations/wp-sheet-editor.php:189
    • > PHP Fatal error
      Uncaught Error: Call to undefined function WCACR() in wp-content/plugins/woo-country-restrictions-advanced/views/action-buttons.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_create_nonce() in wp-content/plugins/woo-country-restrictions-advanced/vendor/vg-plugin-sdk/views/page-template.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/woo-country-restrictions-advanced/modules/core/index.php:29
    • > PHP Fatal error
      require_once(): Failed opening required 'WCACR_DIST_DIR/vendor/freemius/start.php' (include_path='.:/usr/share/php') in wp-content/plugins/woo-country-restrictions-advanced/inc/freemius-init.php on line 16
    • > PHP Warning
      include(): Failed opening 'WCACR_DIST_DIR/views/action-buttons.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/woo-country-restrictions-advanced/views/welcome-page-content.php on line 3

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
3 plugin tags: geolocalization, country restrictions, woocommerce

woo-country-restrictions-advanced/advanced-country-restrictions.php 85% from 13 tests

The primary PHP file in "WooCommerce Country Catalogs - Product Country Restrictions" version 1.14.3 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("3.6" instead of "4.0")
  • Main file name: The principal plugin file should be the same as the plugin slug ("woo-country-restrictions-advanced.php" instead of "advanced-country-restrictions.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected34,998 lines of code in 152 files:
LanguageFilesBlank linesComment linesLines of code
PHP1348,36317,32734,725
JavaScript33459194
CSS146061
XML10018

PHP code 50% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Please fix the following
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity87.65
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.54
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes52
▷ Abstract classes23.85%
▷ Concrete classes5096.15%
▷ Final classes00.00%
Methods1,302
▷ Static methods20015.36%
▷ Public methods91069.89%
▷ Protected methods171.31%
▷ Private methods37528.80%
Functions144
▷ Named functions144100.00%
▷ Anonymous functions00.00%
Constants155
▷ Global constants10869.68%
▷ Class constants4730.32%
▷ Public constants47100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
vendor/freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%