78% sp-random-hello-bar

Code Review | SitePoint Random Hello Bar

WordPress plugin SitePoint Random Hello Bar scored78%from 54 tests.

About plugin

  • Plugin page: sp-random-hello-bar
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.3
  • WordPress version: 6.3.1
  • First release: Jan 21, 2016
  • Latest release: Jan 22, 2016
  • Number of updates: 13
  • Update frequency: every 3.6 days
  • Top authors: sitepointdevs (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,095 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.04MB] [CPU: ▼7.55ms] Passed 4 tests

An overview of server-side resources used by SitePoint Random Hello Bar
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0439.00 ▲2.06
Dashboard /wp-admin3.35 ▲0.0147.45 ▼9.92
Posts /wp-admin/edit.php3.47 ▲0.1143.34 ▼7.36
Add New Post /wp-admin/post-new.php5.93 ▲0.0583.35 ▼11.62
Media Library /wp-admin/upload.php3.28 ▲0.0534.15 ▼1.30
SP Random Hello Bar /wp-admin/options-general.php?page=sp-random-hello-bar3.2432.42

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 30 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for SitePoint Random Hello Bar
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.33 ▼1.041.92 ▲0.2042.77 ▲0.03
Dashboard /wp-admin2,207 ▲195.91 ▲0.0599.99 ▼4.1740.89 ▼0.80
Posts /wp-admin/edit.php2,093 ▲42.00 ▲0.0032.98 ▼2.5233.80 ▼3.74
Add New Post /wp-admin/post-new.php1,536 ▲123.13 ▼0.12595.68 ▼91.1649.38 ▼10.81
Media Library /wp-admin/upload.php1,395 ▲74.19 ▲0.0096.58 ▼10.6342.38 ▼6.36
SP Random Hello Bar /wp-admin/options-general.php?page=sp-random-hello-bar8922.0523.4728.21

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
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 50% 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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/sp-random-hello-bar/src/views/admin/section_two_help.php
  • 8× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/sp-random-hello-bar/src/views/admin/options_page.php:6
    • > PHP Fatal error
      Uncaught Error: Cannot access self:: when no class scope is active in wp-content/plugins/sp-random-hello-bar/src/views/admin/enabled-fields.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/sp-random-hello-bar/sp-random-hello-bar.php:11
    • > PHP Fatal error
      Uncaught Error: Cannot access self:: when no class scope is active in wp-content/plugins/sp-random-hello-bar/src/views/admin/load-css-fields.php:1
    • > PHP Fatal error
      Uncaught Error: Cannot access self:: when no class scope is active in wp-content/plugins/sp-random-hello-bar/src/views/admin/ad_fields.php:32
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/sp-random-hello-bar/src/views/admin/ad_fields.php on line 11
    • > PHP Notice
      Undefined variable: ads in wp-content/plugins/sp-random-hello-bar/src/views/admin/ad_fields.php on line 11
    • > PHP Fatal error
      Uncaught Error: Cannot access self:: when no class scope is active in wp-content/plugins/sp-random-hello-bar/src/views/admin/basic-js-fields.php:1

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #1 (**Hello Bar in use** - An example hello bar being displayed on the Twenty Fifteen theme.), #2 (**SP Random Hello Bar Submenu**), #3 (**Settings** - Quickly enable the hello bar feature and chose what js/css to enqueue.), #4 (**Content** - Add as many hello bars as you wish.)
You can take inspiration from this readme.txt

sp-random-hello-bar/sp-random-hello-bar.php Passed 13 tests

This is the main PHP file of "SitePoint Random Hello Bar" version 1.0.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
72 characters long description:
Displays a random hello bar after scrolling past an element of the page.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin573 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript125919241
PHP94618203
CSS217094
JSON10035

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity16.00
▷ Minimum class complexity16.00
▷ Maximum class complexity16.00
Average method complexity2.15
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods15
▷ Static methods15100.00%
▷ Public methods1280.00%
▷ Protected methods00.00%
▷ Private methods320.00%
Functions4
▷ Named functions00.00%
▷ Anonymous functions4100.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
4 PNG files occupy 0.61MB with 0.42MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png48.18KB13.44KB▼ 72.10%
screenshot-1.png88.03KB24.45KB▼ 72.22%
screenshot-3.png103.09KB34.30KB▼ 66.73%
screenshot-4.png386.95KB129.84KB▼ 66.45%