78% air-quality-data-from-foobot

Code Review | Air Quality Data from Foobot

WordPress plugin Air Quality Data from Foobot scored78%from 54 tests.

About plugin

  • Plugin page: air-quality-data-...
  • Plugin version: 1.2.0
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.4
  • WordPress version: 6.3.1
  • First release: Jan 16, 2020
  • Latest release: Apr 9, 2020
  • Number of updates: 8
  • Update frequency: every 11.1 days
  • Top authors: markcbain (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /802 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
Installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼2.32ms] Passed 4 tests

Server-side resources used by Air Quality Data from Foobot
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0142.51 ▼5.54
Dashboard /wp-admin3.32 ▲0.0151.67 ▼2.74
Posts /wp-admin/edit.php3.37 ▲0.0152.54 ▼1.04
Add New Post /wp-admin/post-new.php5.90 ▲0.0197.79 ▲0.04
Media Library /wp-admin/upload.php3.24 ▲0.0141.20 ▲4.64
Foobot API /wp-admin/options-general.php?page=aq-data-foobot3.1837.38

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 12 new files
Database: 2 new tables, 8 new options
New tables
wp_bd_foobot_sensor_data
wp_bd_foobot_device_data
New WordPress options
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
db_upgraded
bd_foobot_sensor_db_version
widget_theysaidso_widget
bd_foobot_device_db_version
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Air Quality Data from Foobot
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,824 ▲6314.72 ▲0.342.18 ▲0.4342.48 ▼3.99
Dashboard /wp-admin2,199 ▲225.58 ▼0.1490.26 ▼8.1644.79 ▲2.30
Posts /wp-admin/edit.php2,104 ▲11.97 ▼0.0539.35 ▲4.0134.48 ▲0.18
Add New Post /wp-admin/post-new.php1,548 ▲1723.35 ▲0.00662.05 ▼85.7957.87 ▲4.73
Media Library /wp-admin/upload.php1,407 ▲104.20 ▼0.0497.28 ▼15.0645.16 ▼1.72
Foobot API /wp-admin/options-general.php?page=aq-data-foobot8092.0229.4927.30

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin does not fully uninstall, leaving 8 options in the database
    • widget_recent-posts
    • db_upgraded
    • bd_foobot_sensor_db_version
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • bd_foobot_device_db_version
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=aq-data-foobot
    • > Notice in wp-content/plugins/air-quality-data-from-foobot/admin/admin.php+81
    Trying to access array offset on value of type bool

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/air-quality-data-from-foobot/aq-data-foobot.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/air-quality-data-from-foobot/admin/admin.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/air-quality-data-from-foobot/includes/shortcodes.php:45

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

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention:
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
Please take inspiration from this readme.txt

air-quality-data-from-foobot/aq-data-foobot.php 85% from 13 tests

This is the main PHP file of "Air Quality Data from Foobot" version 1.2.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("air-quality-data-from-foobot.php" instead of "aq-data-foobot.php")
  • 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 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin524 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP9180301446
CSS11078

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.07
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions29
▷ Named functions29100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
1 PNG file occupies 0.05MB with 0.03MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png50.70KB20.82KB▼ 58.93%