71% dotdigital-for-woocommerce

Code Review | Dotdigital for WooCommerce

WordPress plugin Dotdigital for WooCommerce scored71%from 54 tests.

About plugin

  • Plugin page: dotdigital-for-wo...
  • Plugin version: 1.4.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0.0-6.3
  • WordPress version: 6.3.1
  • First release: Oct 1, 2021
  • Latest release: Sep 18, 2023
  • Number of updates: 25
  • Update frequency: every 28.8 days
  • Top authors: dotMailer (100%)

Code review

54 tests

User reviews

1 review

Install metrics

90+ active /1,626 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.00MB] [CPU: ▼5.81ms] Passed 4 tests

Analyzing server-side resources used by Dotdigital for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0039.15 ▼1.30
Dashboard /wp-admin3.31 ▲0.0050.36 ▼3.75
Posts /wp-admin/edit.php3.36 ▲0.0040.63 ▼9.22
Add New Post /wp-admin/post-new.php5.89 ▲0.0093.38 ▼8.98
Media Library /wp-admin/upload.php3.23 ▲0.0038.78 ▲0.71
Settings /wp-admin/admin.php?page=dotdigital-for-woocommerce-settings3.0022.13
Connect /wp-admin/admin.php?page=dotdigital-for-woocommerce3.0023.04

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 1,471 new files
Database: 2 new tables, 8 new options
New tables
wp_dd_subscribers
wp_dotmailer_email_marketing
New WordPress options
widget_dd_signup
can_compress_scripts
db_upgraded
dotdigital_for_woocommerce_version
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for Dotdigital for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.38 ▲0.011.90 ▲0.1644.95 ▲3.96
Dashboard /wp-admin2,198 ▲215.67 ▲0.0597.18 ▲8.9042.30 ▼3.30
Posts /wp-admin/edit.php2,103 ▲31.99 ▼0.0338.33 ▲0.9636.26 ▲0.92
Add New Post /wp-admin/post-new.php1,526 ▼1917.50 ▼5.66607.85 ▼63.7954.06 ▲4.36
Media Library /wp-admin/upload.php1,400 ▼04.21 ▼0.0595.62 ▼18.0543.08 ▼5.16
Settings /wp-admin/admin.php?page=dotdigital-for-woocommerce-settings280.440.073.88
Connect /wp-admin/admin.php?page=dotdigital-for-woocommerce280.440.154.01

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

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/dotdigital-for-woocommerce/public/partials/dotdigital-woocommerce-public-display.php
  • 360× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Dotdigital_Woo_Vendor\\Doctrine\\DBAL\\Types\\VarDateTimeImmutableType' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeImmutableType.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Dotdigital_Woo_Vendor\\GuzzleHttp\\Promise\\RejectionException' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/guzzlehttp/promises/src/AggregateException.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'Dotdigital_Woo_Vendor\\Carbon\\Exceptions\\InvalidArgumentException' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitException.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Dotdigital_Woo_Vendor\\Http\\Promise\\Promise' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/php-http/client-common/src/Deferred.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Dotdigital_Woo_Vendor\\GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Dotdigital_Woo_Vendor\\Dotdigital\\V3\\Models\\AbstractSingletonModel' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/dotdigital/dotdigital-php/src/V3/Utility/Pagination/Parameter.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Dotdigital_Woo_Vendor\\Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/guzzlehttp/psr7/src/FnStream.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Dotdigital_Woo_Vendor\\PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/symfony/translation/Test/ProviderFactoryTestCase.php:30
    • > PHP Fatal error
      Uncaught Error: Interface 'Dotdigital_Woo_Vendor\\Http\\Client\\HttpClient' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/php-http/curl-client/src/Client.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'Dotdigital_Woo_Vendor\\Http\\Client\\Exception\\TransferException' not found in wp-content/plugins/dotdigital-for-woocommerce/vendor/php-http/client-common/src/Exception/BatchException.php:15

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=dotdigital-for-woocommerce-settings
    • > Network (severe)
    wp-admin/admin.php?page=dotdigital-for-woocommerce-settings - Failed to load resource: the server responded with a status of 403 (Forbidden)
    • > GET request to /wp-admin/admin.php?page=dotdigital-for-woocommerce
    • > Network (severe)
    wp-admin/admin.php?page=dotdigital-for-woocommerce - Failed to load resource: the server responded with a status of 403 (Forbidden)

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need your attention: Please take inspiration from this readme.txt

dotdigital-for-woocommerce/class-dotdigital-woocommerce-bootstrapper.php 77% from 13 tests

The entry point to "Dotdigital for WooCommerce" version 1.4.0 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("dotdigital-for-woocommerce.php" instead of "class-dotdigital-woocommerce-bootstrapper.php")
  • Requires at least: Required version must be the same as the one declared in readme.txt ("5.7" instead of "6.0.0")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected44,703 lines of code in 1,240 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,2262,56738,63338,979
XSD392482,803
JavaScript755861,593
CSS31341,317
XML10011

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
It is recommended to fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 140)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity9.79
▷ Minimum class complexity1.00
▷ Maximum class complexity351.00
Average method complexity2.64
▷ Minimum method complexity1.00
▷ Maximum method complexity140.00
Code structure
Namespaces107
Interfaces75
Traits42
Classes450
▷ Abstract classes235.11%
▷ Concrete classes42794.89%
▷ Final classes13932.55%
Methods3,277
▷ Static methods56317.18%
▷ Public methods2,74083.61%
▷ Protected methods1986.04%
▷ Private methods33910.34%
Functions538
▷ Named functions17432.34%
▷ Anonymous functions36467.66%
Constants239
▷ Global constants145.86%
▷ Class constants22594.14%
▷ Public constants20792.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
3 PNG files occupy 0.25MB with 0.15MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/image/flags.png68.68KB24.74KB▼ 63.98%
assets/dotdigital-applogo-32x32.png4.25KB1.79KB▼ 57.78%
public/image/flags@2x.png179.65KB69.58KB▼ 61.27%