68% air-quality

Code Review | Air Quality Plugin

WordPress plugin Air Quality Plugin scored68%from 54 tests.

About plugin

  • Plugin page: air-quality
  • Plugin version: 0.40
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-4.9.4
  • WordPress version: 6.3.1
  • First release: Mar 26, 2018
  • Latest release: Apr 12, 2018
  • Number of updates: 25
  • Update frequency: every 0.7 days
  • Top authors: patrol220 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active /1,259 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▼1.62MB] [CPU: ▼63.82ms] Passed 4 tests

This is a short check of server-side resources used by Air Quality Plugin
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.37 ▼1.0911.85 ▼32.59
Dashboard /wp-admin2.38 ▼0.9213.17 ▼42.86
Posts /wp-admin/edit.php2.38 ▼0.9714.34 ▼44.54
Add New Post /wp-admin/post-new.php2.38 ▼3.5013.45 ▼135.28
Media Library /wp-admin/upload.php2.38 ▼0.8416.34 ▼21.46
AQP Settings /wp-admin/options-general.php?page=air-quality/air-quality-plugin.php2.3913.42

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 25 new files
Database: no new tables, 8 new options
New WordPress options
can_compress_scripts
pk_aqp_options
widget_pk_aqp_air_quality_widget
db_upgraded
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Air Quality Plugin
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,819 ▲5813.21 ▼1.371.79 ▼0.1144.11 ▼0.33
Dashboard /wp-admin2,225 ▲254.89 ▼0.96109.45 ▲1.2744.05 ▼1.74
Posts /wp-admin/edit.php2,104 ▲42.02 ▼0.0133.96 ▼4.0636.00 ▼4.14
Add New Post /wp-admin/post-new.php1,534 ▲123.13 ▼0.05677.85 ▲2.5350.87 ▲3.10
Media Library /wp-admin/upload.php1,398 ▼24.14 ▼0.08108.64 ▼7.3645.59 ▼2.22
AQP Settings /wp-admin/options-general.php?page=air-quality/air-quality-plugin.php8882.0222.9828.85

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin cannot be uninstalled
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in pk_aqp_air_quality_widget is deprecated since version 4.3.0! Use __construct() instead.
  • Zombie WordPress options were found after uninstall: 7 options
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • widget_pk_aqp_air_quality_widget
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=air-quality/air-quality-plugin.php
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in pk_aqp_air_quality_widget is deprecated since version 4.3.0! Use __construct() instead.
    • > GET request to /wp-admin/options-general.php?page=air-quality/air-quality-plugin.php
    • > Notice in wp-content/plugins/air-quality/includes/options_menu.php+16
    Undefined index: action
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=air-quality/air-quality-plugin.php
    • > Notice in wp-content/plugins/air-quality/includes/options_menu.php+144
    Undefined index: google_maps_key
    • > GET request to /wp-admin/options-general.php?page=air-quality/air-quality-plugin.php
    • > Notice in wp-content/plugins/air-quality/includes/options_menu.php+148
    Undefined index: waqi_key

SRP 50% 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 items
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/air-quality/air-quality-plugin.php:32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/air-quality/includes/handle_ajax.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention:
  • Donate link: Please fix this invalid URI: "paypal.me/patrol220"
Please take inspiration from this readme.txt

air-quality/air-quality-plugin.php 92% from 13 tests

The primary PHP file in "Air Quality Plugin" version 0.40 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("air-quality.php" instead of "air-quality-plugin.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin1,106 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP56327511
JavaScript2494336
CSS2160132
PO File13743127

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity2.00
▷ Minimum class complexity2.00
▷ Maximum class complexity2.00
Average method complexity1.25
▷ Minimum method complexity1.00
▷ Maximum method complexity2.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.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
8 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/humidity.png2.82KB3.07KB0.00%
img/thermometer.png1.72KB1.88KB0.00%
img/back.png0.75KB0.60KB▼ 19.69%
img/compass-pointer.png3.18KB2.24KB▼ 29.79%
img/barometer.png4.25KB4.02KB▼ 5.38%