83% woo-mailchimp-newsletter-discount

Code Review | WooCommerce MailChimp Newsletter Discount

WordPress plugin WooCommerce MailChimp Newsletter Discount scored83%from 54 tests.

About plugin

  • Plugin page: woo-mailchimp-new...
  • Plugin version: 0.3.5
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.8.3
  • WordPress version: 6.3.1
  • First release: Apr 8, 2019
  • Latest release: Jan 19, 2022
  • Number of updates: 47
  • Update frequency: every 21.7 days
  • Top authors: zetamatic (72.34%)tripathytanmay (19.15%)pitabas106 (12.77%)

Code review

54 tests

User reviews

19 reviews

Install metrics

700+ active /11,936 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.00MB] [CPU: ▲1.38ms] Passed 4 tests

Server-side resources used by WooCommerce MailChimp Newsletter Discount
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0041.64 ▲3.86
Dashboard /wp-admin3.31 ▲0.0050.09 ▲0.83
Posts /wp-admin/edit.php3.36 ▲0.0045.86 ▼0.70
Add New Post /wp-admin/post-new.php5.89 ▲0.0088.60 ▲1.61
Media Library /wp-admin/upload.php3.23 ▲0.0036.70 ▲3.79

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 26 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
wcmnd_activated_on
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for WooCommerce MailChimp Newsletter Discount
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.28 ▼1.101.66 ▼0.4543.86 ▼1.42
Dashboard /wp-admin2,209 ▲185.86 ▲0.96108.57 ▲5.7941.97 ▼1.92
Posts /wp-admin/edit.php2,086 ▼32.01 ▲0.0235.22 ▼5.5132.06 ▼0.84
Add New Post /wp-admin/post-new.php1,533 ▲1623.04 ▲5.49676.94 ▲41.3761.41 ▲2.92
Media Library /wp-admin/upload.php1,385 ▼64.20 ▼0.0099.86 ▼0.9944.85 ▲1.55

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • wcmnd_activated_on
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check 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 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/woo-mailchimp-newsletter-discount/woocommerce-mailchimp-newsletter-discount.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/woo-mailchimp-newsletter-discount/inc/options.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/woo-mailchimp-newsletter-discount/admin/plugin-activation-error.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/woo-mailchimp-newsletter-discount/inc/includes/class-options-sanitization.php:12

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 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Tags: Please reduce the number of tags, currently 14 tag instead of maximum 10
You can look at the official readme.txt

woo-mailchimp-newsletter-discount/woocommerce-mailchimp-newsletter-discount.php 77% from 13 tests

Analyzing the main PHP file in "WooCommerce MailChimp Newsletter Discount" version 0.3.5
Please take the time to fix the following:
  • Text Domain: The text domain follows the same naming rules as the plugin slug: lowercase characters and dashes
  • Domain Path: The domain path folder does not exist ("/languages/")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("woo-mailchimp-newsletter-discount.php" instead of "woocommerce-mailchimp-newsletter-discount.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Everything looks great! No dangerous files found in this plugin9,705 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript7194436,790
PHP136506272,329
CSS2206586

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity44.00
▷ Minimum class complexity8.00
▷ Maximum class complexity97.00
Average method complexity5.65
▷ Minimum method complexity1.00
▷ Maximum method complexity83.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods53
▷ Static methods59.43%
▷ Public methods4788.68%
▷ Protected methods00.00%
▷ Private methods611.32%
Functions47
▷ Named functions4595.74%
▷ Anonymous functions24.26%
Constants11
▷ Global constants1090.91%
▷ Class constants19.09%
▷ Public constants1100.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
2 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/images/extra-fields-addon.png9.14KB3.71KB▼ 59.35%
inc/images/upgrade-to-pro.png7.99KB3.45KB▼ 56.79%