83% woocommerce-gateway-amazon-payments-advanced

Code Review | WooCommerce Amazon Pay

WordPress plugin WooCommerce Amazon Pay scored83%from 54 tests.

About plugin

  • Plugin page: woocommerce-gatew...
  • Plugin version: 2.5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2
  • WordPress version: 6.3.1
  • First release: Jan 22, 2020
  • Latest release: Oct 30, 2023
  • Number of updates: 46
  • Update frequency: every 30.4 days
  • Top authors: automattic (56.52%)woothemes (39.13%)saucal (6.52%)wpmuguru (4.35%)

Code review

54 tests

User reviews

17 reviews

Install metrics

20,000+ active /361,623 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.77MB] [CPU: ▼5.45ms] Passed 4 tests

Analyzing server-side resources used by WooCommerce Amazon Pay
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.25 ▲0.7939.91 ▼0.57
Dashboard /wp-admin4.09 ▲0.7446.43 ▼12.98
Posts /wp-admin/edit.php4.14 ▲0.7850.72 ▼3.67
Add New Post /wp-admin/post-new.php6.67 ▲0.7893.19 ▼4.59
Media Library /wp-admin/upload.php4.01 ▲0.7839.06 ▲6.74

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

Browser metrics Passed 4 tests

WooCommerce Amazon Pay: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.34 ▲0.181.81 ▲0.1041.32 ▼0.55
Dashboard /wp-admin2,189 ▲155.63 ▲0.0593.74 ▲6.0540.93 ▲0.71
Posts /wp-admin/edit.php2,103 ▲32.04 ▲0.0140.78 ▲0.1333.34 ▼5.91
Add New Post /wp-admin/post-new.php1,526 ▼323.01 ▼0.58639.35 ▲42.2253.14 ▼0.58
Media Library /wp-admin/upload.php1,400 ▲34.17 ▼0.0295.56 ▼6.4643.90 ▲0.35

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
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • woocommerce_amazon_payments_new_install
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options

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 applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 185× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Math\\BigInteger\\Engines\\PHP' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'ParagonIE\\ConstantTime\\Base32' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/paragonie/constant_time_encoding/src/Base32Hex.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Prime' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r1.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\Common\\Formats\\Keys\\JWK' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/JWK.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS1' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS1.php:41
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS8' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php:36
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Prime' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v2.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Base' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\DES' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php:42
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\DSA' not found in wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php:24

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% 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
Please fix the following attributes: The official readme.txt is a good inspiration

woocommerce-gateway-amazon-payments-advanced/woocommerce-gateway-amazon-payments-advanced.php 85% from 13 tests

The main file in "WooCommerce Amazon Pay" v. 2.5.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("5.5" instead of "4.0")
  • Description: Please don't use more than 140 characters for the plugin description (currently 491 characters long)

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 plugin60,555 lines of code in 472 files:
LanguageFilesBlank linesComment linesLines of code
PHP4259,36328,07845,365
JavaScript204,8262,23513,062
Markdown940701,316
JSON700555
CSS7230153
SVG20282
XML10019
Bourne Shell1203

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please tend to the following items
  • Method cyclomatic complexity should be reduced to less than 100 (currently 104)
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity18.16
▷ Minimum class complexity1.00
▷ Maximum class complexity670.00
Average method complexity4.14
▷ Minimum method complexity1.00
▷ Maximum method complexity104.00
Code structure
Namespaces42
Interfaces5
Traits4
Classes382
▷ Abstract classes21355.76%
▷ Concrete classes16944.24%
▷ Final classes2514.79%
Methods2,106
▷ Static methods62029.44%
▷ Public methods1,51972.13%
▷ Protected methods31014.72%
▷ Private methods27713.15%
Functions31
▷ Named functions412.90%
▷ Anonymous functions2787.10%
Constants338
▷ Global constants61.78%
▷ Class constants33298.22%
▷ Public constants332100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
11 PNG files occupy 1.29MB with 0.74MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
build/images/amazon-payments.png1.07KB0.99KB▼ 7.33%
docs/images/use-amazon-login-app.png55.67KB20.34KB▼ 63.47%
docs/images/sign-in-from-cart-page.png75.89KB18.56KB▼ 75.54%
docs/images/subscription-notice.png33.93KB10.80KB▼ 68.17%
docs/images/amazon-payments-sign-in.png314.60KB90.07KB▼ 71.37%