10% show-temperature-for-switchbot-meter

Code Review | Show Temperature for SwitchBot Meter

WordPress plugin Show Temperature for SwitchBot Meter scored10%from 54 tests.

About plugin

  • Plugin page: show-temperature-...
  • Plugin version: 1.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.9
  • WordPress version: 6.3.1
  • First release: Nov 23, 2021
  • Latest release: Feb 6, 2022
  • Number of updates: 8
  • Update frequency: every 9.4 days
  • Top authors: shizukanakazushi (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /688 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
You still need to fix the following installer errors
  • The plugin cannot be installed
    • > User notice in wp-includes/functions.php+5905
    Function register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.)

Server metrics [RAM: ▼1.93MB] [CPU: ▼55.15ms] Passed 4 tests

Analyzing server-side resources used by Show Temperature for SwitchBot Meter
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.06 ▼1.415.29 ▼39.78
Dashboard /wp-admin2.08 ▼1.236.20 ▼43.67
Posts /wp-admin/edit.php2.08 ▼1.286.32 ▼40.30
Add New Post /wp-admin/post-new.php2.08 ▼3.816.92 ▼96.85
Media Library /wp-admin/upload.php2.08 ▼1.156.73 ▼30.10
Show SwitchBot Meter /wp-admin/options-general.php?page=sbm_setting_admin2.085.82

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 34 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Show Temperature for SwitchBot Meter
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5814.44 ▲0.221.81 ▲0.0043.51 ▼1.56
Dashboard /wp-admin2,213 ▲255.89 ▼0.03106.66 ▲5.1145.05 ▼1.73
Posts /wp-admin/edit.php2,096 ▲42.01 ▲0.0240.47 ▼2.6835.91 ▼1.12
Add New Post /wp-admin/post-new.php1,517 ▲317.64 ▲0.11694.51 ▲39.2758.43 ▲3.77
Media Library /wp-admin/upload.php1,392 ▲44.23 ▲0.0198.65 ▼9.8847.01 ▼3.33
Show SwitchBot Meter /wp-admin/options-general.php?page=sbm_setting_admin8592.1824.3831.38

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • Uninstall procedure had uncaught errors
    • > User notice in wp-includes/functions.php+5905
    Function register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.)
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/options-general.php?page=sbm_setting_admin
    • > User notice in wp-includes/functions.php+5905
    Function register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.)
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=sbm_setting_admin
    • > Notice in wp-content/plugins/show-temperature-for-switchbot-meter/settings.php+42
    Trying to access array offset on value of type bool

SRP 50% 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
Please fix the following items
  • 17× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Warning
      include_once(): Failed opening '' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/show-temperature-for-switchbot-meter/rest/get_state.php on line 4
    • > PHP Warning
      include_once(wp-content/plugins/show-temperature-for-switchbot-meter/shortcodes): failed to open stream: Resource temporarily unavailable in /var/www/wordpress/wp-content/plugins/show-temperature-for-switchbot-meter/shortcodes/sc_humidity.php on line 4
    • > PHP Notice
      Undefined variable: attr in wp-content/plugins/show-temperature-for-switchbot-meter/shortcodes/sc_image.php on line 10
    • > PHP Warning
      include_once(wp-content/plugins/show-temperature-for-switchbot-meter/shortcodes): failed to open stream: Resource temporarily unavailable in /var/www/wordpress/wp-content/plugins/show-temperature-for-switchbot-meter/shortcodes/sc_temperature.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/show-temperature-for-switchbot-meter/shortcodes/sc_image.php:13
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/show-temperature-for-switchbot-meter/settings_admin_menu.php:162
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/show-temperature-for-switchbot-meter/settings_admin_init.php:122
    • > PHP Notice
      Undefined variable: attr in wp-content/plugins/show-temperature-for-switchbot-meter/shortcodes/sc_humidity.php on line 7
    • > PHP Warning
      include_once(): Failed opening '' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/show-temperature-for-switchbot-meter/shortcodes/sc_humidity.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/show-temperature-for-switchbot-meter/shortcodes/sc_humidity.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 96% from 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
4 plugin tags: meter, temperature, switchbot, humidity

show-temperature-for-switchbot-meter/show-temperature-for-switchbot-meter.php 92% from 13 tests

"Show Temperature for SwitchBot Meter" version 1.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

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
Good job! No executable or dangerous file extensions detected9,854 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
SVG510059,097
PHP1312854579
PO File12628120
CSS1131040
JavaScript14016
Markdown1102

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity3.38
▷ Minimum class complexity1.00
▷ Maximum class complexity10.00
Average method complexity1.49
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods39
▷ Static methods00.00%
▷ Public methods3282.05%
▷ Protected methods00.00%
▷ Private methods717.95%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG images were found in this plugin