83% wc-sales-notification

Code Review | WC Sales Notification

WordPress plugin WC Sales Notification scored 83% from 54 tests.

About plugin

  • Plugin page: wc-sales-notifica...
  • Plugin version: 1.2.4
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Oct 7, 2019
  • Latest release: Aug 7, 2023
  • Number of updates: 22
  • Update frequency: every 63.7 days
  • Top authors: hasthemes (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active / 3,312 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.14MB] [CPU: ▲0.35ms] 75% from 4 tests

An overview of server-side resources used by WC Sales Notification
Please fix the following
  • CPU: You should keep total CPU usage under 500.00ms (currently 1,640.05ms on /wp-admin/admin.php?page=slasnotification-recommendations)
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0541.96 ▲3.64
Dashboard /wp-admin3.54 ▲0.2348.55 ▲1.16
Posts /wp-admin/edit.php3.58 ▲0.2250.02 ▲5.15
Add New Post /wp-admin/post-new.php6.04 ▲0.1694.37 ▼4.74
Media Library /wp-admin/upload.php3.36 ▲0.1435.78 ▲1.36
Recommendations /wp-admin/admin.php?page=slasnotification-recommendations7.671,640.05
Settings /wp-admin/admin.php?page=wcsalenotification3.3638.25

Server storage [IO: ▲0.52MB] [DB: ▲0.67MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 41 new files
Database: no new tables, 10 new options
New WordPress options
widget_recent-comments
wcsales_fakes_data_tabs
db_upgraded
wcsales_general_tabs
widget_recent-posts
wcsales_style_tabs
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
wcsales_settings_tabs

Browser metrics Passed 4 tests

WC Sales Notification: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,002 ▲26715.25 ▲0.851.88 ▲0.0744.02 ▼0.93
Dashboard /wp-admin2,401 ▲2096.81 ▲1.87127.30 ▲19.0139.91 ▼0.15
Posts /wp-admin/edit.php2,318 ▲2293.75 ▲1.7350.71 ▲9.7532.75 ▼2.04
Add New Post /wp-admin/post-new.php1,567 ▲2523.38 ▲5.30580.70 ▼28.1232.89 ▼21.24
Media Library /wp-admin/upload.php1,457 ▲694.62 ▲0.4186.17 ▼10.5544.00 ▲1.21
Recommendations /wp-admin/admin.php?page=slasnotification-recommendations3,1083.5049.78103.59
Settings /wp-admin/admin.php?page=wcsalenotification2,6464.2077.6365.63

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 10 options in the database
    • wcsales_general_tabs
    • wcsales_settings_tabs
    • widget_theysaidso_widget
    • widget_recent-posts
    • wcsales_fakes_data_tabs
    • widget_recent-comments
    • wcsales_style_tabs
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

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 take a closer look at the following
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wc-sales-notification/includes/class.sale_notification.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wc-sales-notification/includes/class.sale_notification_fake.php:17

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 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
5 plugin tags: custom notification, woocommerce, manual notification, sale notification, popup notification

wc-sales-notification/wc_sales_notification.php 92% from 13 tests

The main PHP script in "WC Sales Notification" version 1.2.4 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("wc-sales-notification.php" instead of "wc_sales_notification.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin5,421 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
CSS3534203,066
PHP84363472,217
JavaScript23428138

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity33.17
▷ Minimum class complexity10.00
▷ Maximum class complexity75.00
Average method complexity3.44
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods79
▷ Static methods45.06%
▷ Public methods7696.20%
▷ Protected methods11.27%
▷ Private methods22.53%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants685.71%
▷ Class constants114.29%
▷ Public constants1100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
18 PNG files occupy 0.12MB with 0.07MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
(invalid) admin/assets/images/extensions/docus-pro.png3.98KB0.00KB▼ 100.00%
admin/assets/images/extensions/ht-slider-addons-pro.png6.41KB4.35KB▼ 32.23%
admin/assets/images/fake_data_placeholder.png2.07KB2.35KB0.00%
(invalid) admin/assets/images/extensions/ht-menu.png2.85KB0.00KB▼ 100.00%
admin/assets/images/extensions/multicurrencypro.png19.01KB9.36KB▼ 50.77%