83% onesignal-free-web-push-notifications

Code Review | OneSignal - Web Push Notifications

WordPress plugin OneSignal - Web Push Notifications scored83%from 54 tests.

About plugin

  • Plugin page: onesignal-free-we...
  • Plugin version: 2.4.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-6.2
  • WordPress version: 6.3.1
  • First release: May 1, 2015
  • Latest release: Nov 30, 2023
  • Number of updates: 196
  • Update frequency: every 16.0 days
  • Top authors: OneSignal (100%)

Code review

54 tests

User reviews

346 reviews

Install metrics

100,000+ active /3,775,418 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼7.90ms] Passed 4 tests

This is a short check of server-side resources used by OneSignal - Web Push Notifications
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0335.62 ▼6.82
Dashboard /wp-admin3.33 ▼0.0246.94 ▼12.35
Posts /wp-admin/edit.php3.38 ▲0.0246.28 ▼3.96
Add New Post /wp-admin/post-new.php5.93 ▲0.0490.44 ▼8.48
Media Library /wp-admin/upload.php3.25 ▲0.0233.94 ▲3.29

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 107 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
widget_onesignalwidget
can_compress_scripts
widget_recent-comments
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for OneSignal - Web Push Notifications
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲2913.54 ▼1.178.89 ▲6.8738.72 ▼4.52
Dashboard /wp-admin2,210 ▲335.62 ▲0.0493.44 ▼9.6844.45 ▲0.33
Posts /wp-admin/edit.php2,123 ▲232.04 ▲0.0940.07 ▲3.2435.58 ▼2.68
Add New Post /wp-admin/post-new.php6,294 ▲4,76526.20 ▲2.82852.72 ▲193.1662.14 ▲12.21
Media Library /wp-admin/upload.php1,418 ▲244.28 ▲0.0993.99 ▼10.0741.82 ▲0.53

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_onesignalwidget
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options

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 | 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 fix the following items
  • 9× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/onesignal-free-web-push-notifications/onesignal-admin.php
    • > /wp-content/plugins/onesignal-free-web-push-notifications/onesignal-utils.php
    • > /wp-content/plugins/onesignal-free-web-push-notifications/sdk_files/OneSignalSDKUpdaterWorker.js.php
    • > /wp-content/plugins/onesignal-free-web-push-notifications/onesignal-widget.php
    • > /wp-content/plugins/onesignal-free-web-push-notifications/onesignal.php
    • > /wp-content/plugins/onesignal-free-web-push-notifications/onesignal-public.php
    • > /wp-content/plugins/onesignal-free-web-push-notifications/views/config.php
    • > /wp-content/plugins/onesignal-free-web-push-notifications/sdk_files/OneSignalSDKWorker.js.php
    • > /wp-content/plugins/onesignal-free-web-push-notifications/onesignal-settings.php

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Tags: You are using too many tags: 24 tag instead of maximum 10
You can look at the official readme.txt

onesignal-free-web-push-notifications/onesignal.php 92% from 13 tests

"OneSignal - Web Push Notifications" version 2.4.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("onesignal-free-web-push-notifications.php" instead of "onesignal.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin4,119 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP82562182,217
CSS644500858
SVG200566
JavaScript46479465
HTML30113

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity52.60
▷ Minimum class complexity5.00
▷ Maximum class complexity130.00
Average method complexity6.31
▷ Minimum method complexity1.00
▷ Maximum method complexity85.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods51
▷ Static methods4078.43%
▷ Public methods4996.08%
▷ Protected methods00.00%
▷ Private methods23.92%
Functions5
▷ Named functions480.00%
▷ Anonymous functions120.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
13 PNG files occupy 0.58MB with 0.27MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
views/images/settings/SampleNotification.png4.41KB3.44KB▼ 22.09%
views/images/settings/https-url.png86.63KB28.80KB▼ 66.75%
views/images/settings/chrome-push.png52.85KB18.11KB▼ 65.74%
views/images/menu_icon.png3.10KB1.46KB▼ 52.91%
views/images/SampleNotification.png4.41KB3.44KB▼ 22.09%