83% currency-switcher-for-woocommerce

Code Review | Currency Switcher for WooCommerce

WordPress plugin Currency Switcher for WooCommerce scored 83% from 54 tests.

About plugin

  • Plugin page: currency-switcher...
  • Plugin version: 0.0.7
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.0
  • WordPress version: 6.3.1
  • First release: Apr 17, 2019
  • Latest release: Jun 6, 2022
  • Number of updates: 9
  • Update frequency: every 127.3 days
  • Top authors: pressmaximum (100%)

Code review

54 tests

User reviews

1 review

Install metrics

1,000+ active / 4,749 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼4.33ms] Passed 4 tests

Server-side resources used by Currency Switcher for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0343.91 ▲1.37
Dashboard /wp-admin3.33 ▲0.0346.23 ▼4.09
Posts /wp-admin/edit.php3.38 ▲0.0246.59 ▼3.45
Add New Post /wp-admin/post-new.php5.91 ▲0.0294.21 ▼7.66
Media Library /wp-admin/upload.php3.25 ▲0.0234.62 ▼2.12

Server storage [IO: ▲3.02MB] [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: 397 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by Currency Switcher for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6514.48 ▼0.121.75 ▼0.0641.84 ▼3.35
Dashboard /wp-admin2,209 ▲245.91 ▲0.1294.68 ▼4.1635.51 ▼2.75
Posts /wp-admin/edit.php2,089 ▼02.00 ▼0.0335.77 ▼3.2234.82 ▼0.83
Add New Post /wp-admin/post-new.php1,534 ▼323.18 ▲4.69644.46 ▲38.2160.80 ▲5.60
Media Library /wp-admin/upload.php1,391 ▲34.27 ▲0.0797.50 ▲1.0144.13 ▲0.57

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 75% 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)
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
Please take a closer look at the following
  • 22× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/currency-switcher-for-woocommerce/pmcs.php:42
    • > PHP Fatal error
      Uncaught Error: Class 'PMCS_Setting_Abstract' not found in wp-content/plugins/currency-switcher-for-woocommerce/includes/admin/class-pmcs-settings-geoip.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/currency-switcher-for-woocommerce/includes/class-pmcs-report.php:135
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/currency-switcher-for-woocommerce/includes/metabox/coupon-meta.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'PMCS_Setting_Abstract' not found in wp-content/plugins/currency-switcher-for-woocommerce/includes/admin/class-pmcs-settings-license.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'PMCS_Setting_Abstract' not found in wp-content/plugins/currency-switcher-for-woocommerce/includes/admin/class-pmcs-settings-switcher.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'PMCS_Exchange_Server_Abstract' not found in wp-content/plugins/currency-switcher-for-woocommerce/includes/exchange-rate-api/class-server-yahoo.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'PMCS_Exchange_Server_Abstract' not found in wp-content/plugins/currency-switcher-for-woocommerce/includes/exchange-rate-api/class-server-openexchangerates.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_woocommerce_currencies() in wp-content/plugins/currency-switcher-for-woocommerce/includes/admin/fields/currency-list.php:77
    • > PHP Fatal error
      Uncaught Error: Class 'PMCS_Setting_Abstract' not found in wp-content/plugins/currency-switcher-for-woocommerce/includes/admin/class-pmcs-settings-exchange-rate.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 88% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed: You can look at the official readme.txt

currency-switcher-for-woocommerce/pmcs.php 77% from 13 tests

The entry point to "Currency Switcher for WooCommerce" version 0.0.7 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("currency-switcher-for-woocommerce.php" instead of "pmcs.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Requires at least: Required version does not match the one declared in readme.txt ("4.5" instead of "5.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin3,935 lines of code in 44 files:
LanguageFilesBlank linesComment linesLines of code
PHP316226712,883
JavaScript39733560
Sass2123268
CSS3168193
JSON10023
Markdown4408

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity12.81
▷ Minimum class complexity1.00
▷ Maximum class complexity108.00
Average method complexity2.70
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes27
▷ Abstract classes27.41%
▷ Concrete classes2592.59%
▷ Final classes00.00%
Methods188
▷ Static methods31.60%
▷ Public methods18397.34%
▷ Protected methods42.13%
▷ Private methods10.53%
Functions12
▷ Named functions12100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
347 PNG files occupy 1.56MB with 0.27MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/flags/flags-normal/bd.png2.26KB2.41KB0.00%
assets/flags/flags-normal/kp.png3.15KB3.42KB0.00%
assets/flags/cdf.png3.11KB1.64KB▼ 47.27%
assets/flags/flags-normal/lr.png2.11KB2.14KB0.00%
assets/flags/flags-normal/pa.png4.54KB2.78KB▼ 38.84%