78% connect-sendgrid-for-emails

Code Review | Connect SendGrid for Emails

WordPress plugin Connect SendGrid for Emails scored78%from 54 tests.

About plugin

  • Plugin page: connect-sendgrid-...
  • Plugin version: 1.11.12
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.3.2
  • WordPress version: 6.3.1
  • First release: Aug 11, 2021
  • Latest release: Nov 1, 2023
  • Number of updates: 7
  • Update frequency: every 116.2 days
  • Top authors: annaqq (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

500+ active /3,851 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲1.02MB] [CPU: ▼2.86ms] Passed 4 tests

An overview of server-side resources used by Connect SendGrid for Emails
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.50 ▲1.0347.08 ▲1.84
Dashboard /wp-admin4.34 ▲0.9953.99 ▼11.01
Posts /wp-admin/edit.php4.39 ▲1.0358.58 ▲10.11
Add New Post /wp-admin/post-new.php6.92 ▲1.0391.25 ▼10.92
Media Library /wp-admin/upload.php4.26 ▲1.0343.69 ▲8.65
SendGrid /wp-admin/options-general.php?page=sendgrid-settings4.3443.23

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 79 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
db_upgraded
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Connect SendGrid for Emails
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,820 ▲4914.36 ▲0.001.55 ▼0.4842.95 ▼0.52
Dashboard /wp-admin2,229 ▲495.81 ▲0.1493.46 ▲2.7239.34 ▼2.10
Posts /wp-admin/edit.php2,104 ▲42.03 ▲0.0439.23 ▲2.6035.28 ▲0.65
Add New Post /wp-admin/post-new.php1,531 ▲223.05 ▼0.06624.22 ▼8.3851.79 ▼4.62
Media Library /wp-admin/upload.php1,407 ▲44.16 ▼0.1298.43 ▼3.0042.06 ▼2.02
SendGrid /wp-admin/options-general.php?page=sendgrid-settings1,5842.1944.7842.04

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
Almost there! Just fix the following items
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/connect-sendgrid-for-emails/view/sendgrid_settings_nav.php
    • > /wp-content/plugins/connect-sendgrid-for-emails/view/sendgrid_contextual_help.php
  • 31× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function SendGridTrueBV\\plugin_dir_path() in wp-content/plugins/connect-sendgrid-for-emails/vendor/punycode/Punycode.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/connect-sendgrid-for-emails/lib/class-sendgrid-statistics.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/connect-sendgrid-for-emails/lib/class-sendgrid-nlvx.php:3
    • > PHP Notice
      Undefined variable: active_tab in wp-content/plugins/connect-sendgrid-for-emails/view/sendgrid_settings_nlvx.php on line 1
    • > PHP Notice
      Undefined variable: active_tab in wp-content/plugins/connect-sendgrid-for-emails/view/sendgrid_settings_test_email.php on line 1
    • > PHP Fatal error
      Uncaught Error: Class 'Sendgrid_Tools' not found in wp-content/plugins/connect-sendgrid-for-emails/view/sendgrid_stats.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/connect-sendgrid-for-emails/vendor/autoload.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/connect-sendgrid-for-emails/lib/sendgrid/sendgrid-wp-mail.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_bloginfo() in wp-content/plugins/connect-sendgrid-for-emails/view/partials/sendgrid_stats_widget.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/connect-sendgrid-for-emails/view/partials/sendgrid_stats_compliance.php:6

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

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Tags: Too many tags (17 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

connect-sendgrid-for-emails/connect-sendgrid-for-emails.php Passed 13 tests

The main file in "Connect SendGrid for Emails" v. 1.11.12 serves as a complement to information provided in readme.txt and as the entry point to the plugin
99 characters long description:
Connect SendGrid to your WordPress site to send emails using SendGrid's cloud-based email platform.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected12,489 lines of code in 59 files:
LanguageFilesBlank linesComment linesLines of code
PHP481,3892,2576,976
JavaScript89017064,536
CSS39545977

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 180)
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity18.33
▷ Minimum class complexity1.00
▷ Maximum class complexity180.00
Average method complexity2.74
▷ Minimum method complexity1.00
▷ Maximum method complexity180.00
Code structure
Namespaces5
Interfaces1
Traits0
Classes48
▷ Abstract classes00.00%
▷ Concrete classes48100.00%
▷ Final classes00.00%
Methods485
▷ Static methods14730.31%
▷ Public methods42788.04%
▷ Protected methods91.86%
▷ Private methods4910.10%
Functions16
▷ Named functions1593.75%
▷ Anonymous functions16.25%
Constants129
▷ Global constants8767.44%
▷ Class constants4232.56%
▷ Public constants42100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
13 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
view/css/datepicker/smoothness/images/ui-icons_2e83ff_256x240.png4.44KB4.17KB▼ 6.02%
view/css/datepicker/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png0.32KB0.15KB▼ 54.82%
view/css/datepicker/smoothness/images/ui-icons_888888_256x240.png6.83KB4.17KB▼ 38.92%
view/css/datepicker/smoothness/images/ui-bg_flat_75_ffffff_40x100.png0.20KB0.08KB▼ 58.17%
view/css/datepicker/smoothness/images/ui-icons_cd0a0a_256x240.png4.44KB4.17KB▼ 6.02%