83% national-weather-service-alerts

Code Review | National Weather Service Alerts

WordPress plugin National Weather Service Alerts scored83%from 54 tests.

About plugin

  • Plugin page: national-weather-...
  • Plugin version: 1.3.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-4.9
  • WordPress version: 6.3.1
  • First release: Nov 4, 2014
  • Latest release: Feb 8, 2018
  • Number of updates: 35
  • Update frequency: every 34.1 days
  • Top authors: laubsterboy (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

200+ active /8,165 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.30MB] [CPU: ▼1.63ms] Passed 4 tests

An overview of server-side resources used by National Weather Service Alerts
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.77 ▲0.3050.60 ▲4.95
Dashboard /wp-admin3.59 ▲0.2959.70 ▲3.64
Posts /wp-admin/edit.php3.71 ▲0.3551.51 ▼5.98
Add New Post /wp-admin/post-new.php6.19 ▲0.3195.05 ▼9.14
Media Library /wp-admin/upload.php3.52 ▲0.2946.16 ▲7.00
NWS Alerts /wp-admin/options-general.php?page=nws-alerts3.4839.89

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 49 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by National Weather Service Alerts
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,803 ▲4214.35 ▼0.081.74 ▼0.0543.69 ▼3.36
Dashboard /wp-admin2,206 ▲295.58 ▼0.0294.93 ▼3.2743.34 ▲0.37
Posts /wp-admin/edit.php2,114 ▲111.98 ▲0.0335.25 ▼5.5733.23 ▼2.62
Add New Post /wp-admin/post-new.php1,539 ▲1123.79 ▲0.72668.33 ▼4.3060.36 ▲8.99
Media Library /wp-admin/upload.php1,414 ▲144.19 ▲0.09103.64 ▼3.1647.38 ▲0.89
NWS Alerts /wp-admin/options-general.php?page=nws-alerts1,1712.0125.3631.99

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
The following issues need your attention
  • 42× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: args in wp-content/plugins/national-weather-service-alerts/templates/template-display-list.php on line 23
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/national-weather-service-alerts/templates/template-display-bar.php on line 19
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/national-weather-service-alerts/templates/template-display-bar.php on line 17
    • > PHP Notice
      Undefined variable: settings in wp-content/plugins/national-weather-service-alerts/templates/template-display-list.php on line 15
    • > PHP Notice
      Undefined variable: args in wp-content/plugins/national-weather-service-alerts/templates/template-display-list.php on line 17
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/national-weather-service-alerts/classes/class-nws-alerts-widgets.php:6
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/national-weather-service-alerts/templates/template-display-bar.php:19
    • > PHP Notice
      Undefined variable: classes in wp-content/plugins/national-weather-service-alerts/templates/template-display-full.php on line 15
    • > PHP Notice
      Undefined variable: args in wp-content/plugins/national-weather-service-alerts/templates/template-display-bar.php on line 17
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/national-weather-service-alerts/templates/template-display-list.php on line 23

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

readme.txt 81% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: These screenshots lack descriptions #2, #3, #4, #5 in national-weather-service-alerts/assets to your readme.txt
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === national-weather-service-alerts === )
  • Tags: You are using too many tags: 11 tag instead of maximum 10
Please take inspiration from this readme.txt

national-weather-service-alerts/nws-alerts.php 92% from 13 tests

"National Weather Service Alerts" version 1.3.5's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("national-weather-service-alerts.php" instead of "nws-alerts.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
Everything looks great! No dangerous files found in this plugin2,524 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
PHP154716931,480
CSS27614461
JavaScript34027270
Markdown130190
SVG606123

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity38.43
▷ Minimum class complexity4.00
▷ Maximum class complexity99.00
Average method complexity6.46
▷ Minimum method complexity1.00
▷ Maximum method complexity59.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods48
▷ Static methods3266.67%
▷ Public methods4695.83%
▷ Protected methods00.00%
▷ Private methods24.17%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants34
▷ Global constants34100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
8 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/nws-alerts-mce-icon-hi-res.png7.52KB3.51KB▼ 53.38%
images/winter-storm-warning.png3.49KB1.65KB▼ 52.65%
images/blizzard-warning.png4.61KB2.35KB▼ 49.05%
images/flash-flood-warning.png3.17KB1.55KB▼ 51.05%
images/nws-alerts-mce-icon.png3.15KB0.66KB▼ 78.90%