77% aco-currency-switcher-for-woocommerce

Code Review | Currency Switcher for WooCommerce

WordPress plugin Currency Switcher for WooCommerce scored77%from 54 tests.

About plugin

  • Plugin page: aco-currency-swit...
  • Plugin version: 2.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4.0-6.3
  • WordPress version: 6.3.1
  • First release: Sep 9, 2021
  • Latest release: Sep 5, 2023
  • Number of updates: 14
  • Update frequency: every 53.0 days
  • Top authors: acowebscd (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,847 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.01MB] [CPU: ▼4.02ms] Passed 4 tests

A check of server-side resources used by Currency Switcher for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0045.49 ▲4.13
Dashboard /wp-admin3.31 ▲0.0157.15 ▲3.50
Posts /wp-admin/edit.php3.36 ▲0.0150.79 ▲1.71
Add New Post /wp-admin/post-new.php5.91 ▲0.0389.84 ▼25.24
Media Library /wp-admin/upload.php3.23 ▲0.0137.79 ▲3.94

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 307 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Currency Switcher for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,795 ▲3414.28 ▲0.011.75 ▼0.1643.99 ▲1.01
Dashboard /wp-admin2,204 ▲275.60 ▼0.0489.07 ▼2.9640.78 ▼8.22
Posts /wp-admin/edit.php2,106 ▲61.97 ▲0.0138.53 ▲0.7734.83 ▲2.45
Add New Post /wp-admin/post-new.php1,532 ▲623.54 ▲0.51672.36 ▼13.7055.33 ▼10.48
Media Library /wp-admin/upload.php1,409 ▲94.25 ▲0.06104.08 ▼2.5949.58 ▲5.05

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 0% 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 take a closer look at the following
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/aco-currency-switcher-for-woocommerce/includes/class-acowcs-fixeduser.php
    • > /wp-content/plugins/aco-currency-switcher-for-woocommerce/includes/class-acowcs-fixedamount.php
  • 7× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_woocommerce_currencies() in wp-content/plugins/aco-currency-switcher-for-woocommerce/view/acowcs_widget.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_woocommerce_currencies() in wp-content/plugins/aco-currency-switcher-for-woocommerce/view/shortcode.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/aco-currency-switcher-for-woocommerce/view/variation-metabox.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_product() in wp-content/plugins/aco-currency-switcher-for-woocommerce/view/calculator.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/aco-currency-switcher-for-woocommerce/includes/class-acowcs-widget.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/aco-currency-switcher-for-woocommerce/aco-woo-currency-switcher.php:20
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/aco-currency-switcher-for-woocommerce/view/switcher.php:2

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 88% 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
These attributes need your attention:
  • Donate link: Please fix this invalid URI: ""
  • Tags: Please reduce the number of tags, currently 11 tag instead of maximum 10
You can take inspiration from this readme.txt

aco-currency-switcher-for-woocommerce/aco-woo-currency-switcher.php 92% from 13 tests

"Currency Switcher for WooCommerce" version 2.1.3's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("aco-currency-switcher-for-woocommerce.php" instead of "aco-woo-currency-switcher.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin5,693 lines of code in 298 files:
LanguageFilesBlank linesComment linesLines of code
PHP151,0149483,443
SVG26600865
CSS7502788
PO File2167193362
JavaScript6309163
JSON20072

PHP code 50% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 138)
Cyclomatic complexity
Average complexity per logical line of code0.68
Average class complexity88.25
▷ Minimum class complexity2.00
▷ Maximum class complexity350.00
Average method complexity6.52
▷ Minimum method complexity1.00
▷ Maximum method complexity138.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods107
▷ Static methods54.67%
▷ Public methods9487.85%
▷ Protected methods00.00%
▷ Private methods1312.15%
Functions35
▷ Named functions720.00%
▷ Anonymous functions2880.00%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.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
No PNG files were detected