74% woocommerce-gateway-paypal-powered-by-braintree

Code Review | Braintree for WooCommerce Payment Gateway

WordPress plugin Braintree for WooCommerce Payment Gateway scored74%from 54 tests.

About plugin

  • Plugin page: woocommerce-gatew...
  • Plugin version: 3.0.9
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.2-6.4
  • WordPress version: 6.3.1
  • First release: Jan 5, 2016
  • Latest release: Nov 21, 2023
  • Number of updates: 129
  • Update frequency: every 22.4 days
  • Top authors: SkyVerge (49.61%)automattic (14.73%)akeda (14.73%)royho (9.3%)bor0 (5.43%)

Code review

54 tests

User reviews

47 reviews

Install metrics

20,000+ active /1,941,292 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.07MB] [CPU: ▼1.91ms] Passed 4 tests

Server-side resources used by Braintree for WooCommerce Payment Gateway
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0736.89 ▼0.82
Dashboard /wp-admin3.37 ▲0.0746.76 ▼3.13
Posts /wp-admin/edit.php3.48 ▲0.1348.78 ▼0.53
Add New Post /wp-admin/post-new.php5.95 ▲0.0692.89 ▼3.15
Media Library /wp-admin/upload.php3.29 ▲0.0634.98 ▲3.48

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 459 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
can_compress_scripts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
woocommerce_braintree_paypal_settings

Browser metrics Passed 4 tests

An overview of browser requirements for Braintree for WooCommerce Payment Gateway
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,798 ▲3614.27 ▼0.441.80 ▲0.2537.34 ▼1.26
Dashboard /wp-admin2,206 ▲315.63 ▼0.0895.04 ▼16.0045.25 ▼1.35
Posts /wp-admin/edit.php2,109 ▲92.01 ▲0.0540.89 ▼0.2936.81 ▲3.47
Add New Post /wp-admin/post-new.php1,534 ▼223.10 ▼0.28643.07 ▼18.2143.88 ▼7.34
Media Library /wp-admin/upload.php1,408 ▲114.23 ▲0.0095.83 ▼3.5340.93 ▲1.25

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
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • woocommerce_braintree_paypal_settings
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

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 fix the following items
  • 125× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Modification' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/Discount.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/DocumentUpload.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/Exception/Timeout.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/Modification.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/Transaction/SubscriptionDetails.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/Exception/Configuration.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/BinData.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/SamsungPayCard.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/Transaction/ApplePayCardDetails.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/Braintree/Address.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes:
  • Tags: You are using too many tags: 15 tag instead of maximum 10
You can take inspiration from this readme.txt

woocommerce-gateway-paypal-powered-by-braintree/woocommerce-gateway-paypal-powered-by-braintree.php 92% from 13 tests

The principal PHP file in "Braintree for WooCommerce Payment Gateway" v. 3.0.9 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 216 characters long)

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Almost there! Just fix the following issues
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/vendor/braintree/braintree_php/lib/ssl/api_braintreegateway_com.ca.crt
      • wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/lib/ssl/api_braintreegateway_com.ca.crt
34,984 lines of code in 413 files:
LanguageFilesBlank linesComment linesLines of code
PHP33513,28728,91329,869
JavaScript443236473,006
PO File14367871,110
Markdown22250726
CSS8195108
JSON10097
XML191447
SVG210021

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity12.11
▷ Minimum class complexity1.00
▷ Maximum class complexity274.00
Average method complexity2.26
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces32
Interfaces14
Traits1
Classes304
▷ Abstract classes3411.18%
▷ Concrete classes27088.82%
▷ Final classes20.74%
Methods2,901
▷ Static methods57519.82%
▷ Public methods2,13773.66%
▷ Protected methods61021.03%
▷ Private methods1545.31%
Functions21
▷ Named functions14.76%
▷ Anonymous functions2095.24%
Constants957
▷ Global constants20.21%
▷ Class constants95599.79%
▷ Public constants955100.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
25 PNG files occupy 0.06MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/button/connect-braintree@2x.png8.85KB3.63KB▼ 58.93%
vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-paypal.png0.76KB0.79KB0.00%
vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-visa.png0.82KB0.85KB0.00%
vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-visa-debit.png0.80KB0.86KB0.00%
vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/images/card-cc-invalid.png3.50KB1.60KB▼ 54.40%