58% live-weather-station

Code Review | Weather Station

WordPress plugin Weather Station scored 58% from 54 tests.

About plugin

  • Plugin page: live-weather-station
  • Plugin version: 3.8.13
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.2.2
  • WordPress version: 6.3.1
  • First release: Nov 14, 2015
  • Latest release: Aug 1, 2023
  • Number of updates: 399
  • Update frequency: every 7.2 days
  • Top authors: PierreLannoy (99.25%)jaz_on (1%)

Code review

54 tests

User reviews

69 reviews

Install metrics

3,000+ active / 266,912 total downloads

Benchmarks

Plugin footprint 47% 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: ▲6.47MB] [CPU: ▲9.99ms] 75% from 4 tests

An overview of server-side resources used by Weather Station
The following require your attention
  • Extra RAM: Try to keep extra memory usage under 5MB (currently 6.47MB on /wp-admin/upload.php)
PageMemory (MB)CPU Time (ms)
Home /9.34 ▲5.8844.66 ▼1.12
Dashboard /wp-admin10.02 ▲6.7266.60 ▲15.62
Posts /wp-admin/edit.php10.06 ▲6.7064.02 ▲9.78
Add New Post /wp-admin/post-new.php12.54 ▲6.65101.73 ▲15.68
Media Library /wp-admin/upload.php9.89 ▲6.6657.39 ▲17.24

Server storage [IO: ▲13.49MB] [DB: ▲0.05MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 589 new files
Database: 15 new tables, no new options
New tables
wp_live_weather_station_quota_day
wp_live_weather_station_datas_day
wp_live_weather_station_data_year
wp_live_weather_station_log
wp_live_weather_station_module_detail
wp_live_weather_station_stations
wp_live_weather_station_quota_year
wp_live_weather_station_performance_cache
wp_live_weather_station_background_process
wp_live_weather_station_performance_cron
...

Browser metrics Passed 4 tests

Checking browser requirements for Weather Station
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,954 ▲21913.44 ▼0.941.53 ▼0.9742.10 ▼9.32
Dashboard /wp-admin2,358 ▲1705.22 ▲0.32117.63 ▼6.2345.02 ▼1.64
Posts /wp-admin/edit.php2,194 ▲1052.49 ▲0.4944.78 ▲6.6635.97 ▲3.37
Add New Post /wp-admin/post-new.php1,570 ▲3523.69 ▲0.51600.89 ▼234.3553.83 ▼13.86
Media Library /wp-admin/upload.php1,489 ▲1014.54 ▲0.39102.28 ▼17.2746.33 ▼9.14

Uninstaller [IO: ▲13.49MB] [DB: ▲0.06MB] 25% from 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Uninstall procedure had uncaught errors
    • > Error in wp-includes/l10n.php+102
    Uncaught Error: Call to undefined function get_user_by() in wp-includes/l10n.php:102
    Stack trace:
    #0 wp-content/plugins/live-weather-station/functions.php(89): get_user_locale()
    #1 wp-content/plugins/live-weather-station/includes/classes/I18nHelper.php(43): lws_get_display_locale()
    #2 wp-content/plugins/live-weather-station/includes/traits/SystemSchedulesHandling.php(1106): WeatherStation\System\I18N\Handling->__construct()
    #3 [internal function]: WeatherStation\System\Schedules\Watchdog::define_translation_update_cron()
    #4 wp-content/plugins/live-weather-station/includes/traits/SystemSchedulesHandling.php(194): call_user_func()
    #5 wp-content/plugins/live-weather-station/includes/traits/SystemSchedulesHandling.php(211): WeatherStation\System\Schedules\Watchdog::define_cron()
    #6 wp-content/plugins/live-weather-station/includes/system/Watchdog.php(66): WeatherStation\System\Schedu
  • Incomplete uninstall procedure, leaving 589 files (13.49MB) in the plugin directory
    • (new file) admin/js/live-weather-station-admin.min.js
    • (new file) admin/js/live-weather-station-admin.js
    • (new file) admin/css/live-weather-station-admin.css
    • (new file) .gitattributes
    • (new file) admin/css/index.php
    • (new file) admin/css/live-weather-station-admin.min.css
    • (new file) admin/js/clipboard.min.js
    • (new file) admin/js/index.php
    • (new file) admin/index.php
    • (new file) admin/SystemPluginAdmin.php
    • ...
  • The uninstall procedure failed, leaving 15 tables in the database
    • wp_live_weather_station_datas_year
    • wp_live_weather_station_stations
    • wp_live_weather_station_performance_cron
    • wp_live_weather_station_quota_year
    • wp_live_weather_station_maps
    • wp_live_weather_station_background_process
    • wp_live_weather_station_performance_cache
    • wp_live_weather_station_medias
    • wp_live_weather_station_data_year
    • wp_live_weather_station_module_detail
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
  • 12× PHP files output non-empty strings when accessed directly via GET requests (only 10 are shown):
    • > /wp-content/plugins/live-weather-station/admin/partials/DashboardTranslation.php
    • > /wp-content/plugins/live-weather-station/public/partials/WidgetThunderstormDisplay.php
    • > /wp-content/plugins/live-weather-station/public/partials/WidgetOutdoorDisplay.php
    • > /wp-content/plugins/live-weather-station/public/partials/WidgetPsychrometryDisplay.php
    • > /wp-content/plugins/live-weather-station/public/partials/WidgetSolarDisplay.php
    • > /wp-content/plugins/live-weather-station/admin/partials/MapSummary.php
    • > /wp-content/plugins/live-weather-station/admin/partials/StationTools.php
    • > /wp-content/plugins/live-weather-station/public/partials/WidgetEphemerisDisplay.php
    • > /wp-content/plugins/live-weather-station/public/partials/WidgetFireDisplay.php
    • > /wp-content/plugins/live-weather-station/public/partials/WidgetDisplayCSS.php
  • 540× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Notice
      Undefined variable: import_link in wp-content/plugins/live-weather-station/admin/partials/StationTools.php on line 14
    • > PHP Notice
      Undefined variable: show_sun in wp-content/plugins/live-weather-station/public/partials/WidgetEphemerisDisplay.php on line 41
    • > PHP Notice
      Undefined variable: show_vapor_pressure in wp-content/plugins/live-weather-station/public/partials/WidgetPsychrometryDisplay.php on line 157
    • > PHP Fatal error
      Trait 'WeatherStation\\Data\\Dashboard\\Handling' not found in wp-content/plugins/live-weather-station/includes/traits/PioupiouPluginBaseClient.php on line 19
    • > PHP Fatal error
      Trait 'WeatherStation\\System\\Schedules\\Handling' not found in wp-content/plugins/live-weather-station/includes/system/Performance.php on line 20
    • > PHP Fatal error
      Trait 'WeatherStation\\SDK\\Ambient\\Plugin\\Client' not found in wp-content/plugins/live-weather-station/includes/classes/WeatherCurrentAmbientStationUpdater.php on line 13
    • > PHP Notice
      Undefined variable: map_name in wp-content/plugins/live-weather-station/admin/partials/MapSummary.php on line 13
    • > PHP Notice
      Undefined variable: show_cloud_ceiling in wp-content/plugins/live-weather-station/public/partials/WidgetOutdoorDisplay.php on line 275
    • > PHP Fatal error
      Uncaught Error: Class 'WeatherStation\\Engine\\Module\\Maintainer' not found in wp-content/plugins/live-weather-station/includes/classes/ModuleClimatTextual.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/live-weather-station/admin/partials/StationPages.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
5 plugin tags: weather, weatherflow, weatherstation, openweathermap, netatmo

live-weather-station/live-weather-station.php Passed 13 tests

"Weather Station" version 3.8.13's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
127 characters long description:
Display on your WordPress site, in many elegant ways, the meteorological data collected by public or personal weather stations.

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected99,732 lines of code in 503 files:
LanguageFilesBlank linesComment linesLines of code
PHP4335,83021,73672,005
JavaScript422,1342,16814,143
SVG70011,740
CSS202921021,824
XML10020

PHP code 0% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 3,535)
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 488)
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity39.21
▷ Minimum class complexity1.00
▷ Maximum class complexity3,535.00
Average method complexity5.37
▷ Minimum method complexity1.00
▷ Maximum method complexity488.00
Code structure
Namespaces85
Interfaces8
Traits44
Classes255
▷ Abstract classes197.45%
▷ Concrete classes23692.55%
▷ Final classes00.00%
Methods2,765
▷ Static methods59421.48%
▷ Public methods1,22844.41%
▷ Protected methods1,21744.01%
▷ Private methods32011.57%
Functions49
▷ Named functions3877.55%
▷ Anonymous functions1122.45%
Constants207
▷ Global constants10148.79%
▷ Class constants10651.21%
▷ Public constants106100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
There are no PNG files in this plugin