58% location-weather

Code Review | Location Weather – Best Weather Forecast Widget Plugin for WordPress

WordPress plugin Location Weather – Best Weather Forecast Widget Plugin for WordPress scored58%from 54 tests.

About plugin

  • Plugin page: location-weather
  • Plugin version: 2.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: Apr 21, 2016
  • Latest release: Nov 17, 2023
  • Number of updates: 63
  • Update frequency: every 44.0 days
  • Top authors: shapedplugin (55.56%)rubel_miah (39.68%)Shamimmiashuhagh (7.94%)

Code review

54 tests

User reviews

36 reviews

Install metrics

9,000+ active /182,209 total downloads

Benchmarks

Plugin footprint 48% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲1.11MB] [CPU: ▲7.78ms] Passed 4 tests

Server-side resources used by Location Weather – Best Weather Forecast Widget Plugin for WordPress
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.75 ▲1.2847.71 ▲6.56
Dashboard /wp-admin4.43 ▲1.0856.74 ▼3.32
Posts /wp-admin/edit.php4.46 ▲1.1060.90 ▲15.77
Add New Post /wp-admin/post-new.php7.02 ▲1.13101.85 ▲12.12
Media Library /wp-admin/upload.php4.35 ▲1.1250.79 ▲17.32
Manage Weather /wp-admin/edit.php?post_type=location_weather4.7866.02
Add New /wp-admin/post-new.php?post_type=location_weather4.8076.71
Settings /wp-admin/edit.php?post_type=location_weather&page=lw-settings4.6556.50
Help /wp-admin/edit.php?post_type=location_weather&page=splw_help4.6550.06
Tools /wp-admin/edit.php?post_type=location_weather&page=lw-tools4.6565.80

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 239 new files
Database: no new tables, 14 new options
New WordPress options
widget_sp_location_weather_widget_content
db_upgraded
widget_theysaidso_widget
widget_recent-comments
location_weather_activation_date
can_compress_scripts
location_weather_version
widget_lw_widget
widget_recent-posts
location_weather_settings
...

Browser metrics Passed 4 tests

An overview of browser requirements for Location Weather – Best Weather Forecast Widget Plugin for WordPress
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,993 ▲23113.51 ▼0.537.36 ▲5.7530.83 ▼12.66
Dashboard /wp-admin2,293 ▲1195.57 ▲0.0295.57 ▼5.4172.27 ▲27.49
Posts /wp-admin/edit.php2,214 ▲1111.99 ▼0.0240.58 ▲5.3537.67 ▲0.41
Add New Post /wp-admin/post-new.php1,596 ▲7022.39 ▼0.81652.02 ▼35.75117.38 ▲54.34
Media Library /wp-admin/upload.php1,504 ▲1014.21 ▼0.0799.49 ▼1.8880.69 ▲34.05
Manage Weather /wp-admin/edit.php?post_type=location_weather1,4053.6963.8460.42
Add New /wp-admin/post-new.php?post_type=location_weather9,2625.08120.20225.00
Settings /wp-admin/edit.php?post_type=location_weather&page=lw-settings1,2513.6457.69120.44
Help /wp-admin/edit.php?post_type=location_weather&page=splw_help2,05313.41318.71179.74
Tools /wp-admin/edit.php?post_type=location_weather&page=lw-tools1,2453.7460.1982.91

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Uninstall procedure had uncaught errors
    • > Compile error in wp-content/plugins/location-weather/main.php+299
    Cannot redeclare location_weather() (previously declared in wp-content/plugins/location-weather/main.php:300)
  • Incomplete uninstall procedure, leaving 239 files (1.73MB) in the plugin directory
    • (new file) assets/css/all.min.css
    • (new file) assets/css/admin.css
    • (new file) assets/css/admin.min.css
    • (new file) assets/css/help-page.css
    • (new file) assets/css/old-style.min.css
    • (new file) assets/css/old-style.css
    • (new file) assets/css/fontawesome.min.css
    • (new file) assets/css/help-page.min.css
    • (new file) assets/css/fontello.min.css
    • (new file) assets/css/fontello.css
    • ...
  • Zombie WordPress options detected upon uninstall: 15 options
    • widget_lw_widget
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • location_weather_tools_options
    • location_weather_version
    • location_weather_activation_date
    • widget_sp_location_weather_widget_content
    • location_weather_first_version
    • recovery_mode_email_last_sent
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/location-weather/includes/Frontend/templates/template-parts/footer.php
    • > /wp-content/plugins/location-weather/includes/Frontend/templates/section-title.php
  • 31× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function ShapedPlugin\\Weather\\Admin\\Preview\\add_action() in wp-content/plugins/location-weather/includes/Admin/Preview/LW_Preview.php:37
    • > PHP Notice
      Undefined variable: show_wind_gusts in wp-content/plugins/location-weather/includes/Frontend/templates/template-parts/additional-data.php on line 14
    • > PHP Notice
      Undefined variable: weather_data in wp-content/plugins/location-weather/includes/Frontend/templates/template-parts/header.php on line 10
    • > PHP Fatal error
      Uncaught Error: Class 'ShapedPlugin\\Weather\\Frontend\\Aid\\Location' not found in wp-content/plugins/location-weather/includes/Frontend/Aid/City.php:13
    • > PHP Notice
      Undefined variable: layout in wp-content/plugins/location-weather/includes/Frontend/templates/additional-icon.php on line 11
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/location-weather/includes/Admin/LW_Widget.php:15
    • > PHP Notice
      Undefined variable: show_wind in wp-content/plugins/location-weather/includes/Frontend/templates/template-parts/additional-data.php on line 14
    • > PHP Fatal error
      Uncaught Error: Class 'Elementor\\Widget_Base' not found in wp-content/plugins/location-weather/includes/Admin/ElementBlock/Location_Weather_Shortcode_Widget.php:23
    • > PHP Notice
      Undefined variable: show_visibility in wp-content/plugins/location-weather/includes/Frontend/templates/template-parts/additional-data.php on line 14
    • > PHP Notice
      Undefined variable: show_weather_updated_time in wp-content/plugins/location-weather/includes/Frontend/templates/template-parts/footer.php on line 13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 27 tag instead of maximum 10
You can take inspiration from this readme.txt

location-weather/main.php 85% from 13 tests

"Location Weather – Best Weather Forecast Widget Plugin for WordPress" version 2.0.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("location-weather.php" instead of "main.php")
  • Description: Please don't use more than 140 characters for the plugin description (currently 267 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin16,890 lines of code in 211 files:
LanguageFilesBlank linesComment linesLines of code
PHP901,6133,5807,964
CSS168334754,905
JavaScript98873383,393
SVG9509623
JSON1005

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.54
Average class complexity18.79
▷ Minimum class complexity1.00
▷ Maximum class complexity136.00
Average method complexity4.95
▷ Minimum method complexity1.00
▷ Maximum method complexity59.00
Code structure
Namespaces10
Interfaces0
Traits0
Classes57
▷ Abstract classes23.51%
▷ Concrete classes5596.49%
▷ Final classes11.82%
Methods259
▷ Static methods6424.71%
▷ Public methods24895.75%
▷ Protected methods20.77%
▷ Private methods93.47%
Functions27
▷ Named functions2488.89%
▷ Anonymous functions311.11%
Constants8
▷ Global constants8100.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
3 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/Admin/framework/assets/images/checkerboard.png2.29KB2.54KB0.00%
includes/Admin/framework/assets/images/icon-256.png11.28KB3.62KB▼ 67.92%
assets/images/Dawie-Hanekom-min.png10.69KB10.71KB0.00%