79% wp-mkd-air-quality

Code Review | MKD Air Quality

WordPress plugin MKD Air Quality scored79%from 54 tests.

About plugin

  • Plugin page: wp-mkd-air-quality
  • Plugin version: 1.1.2
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5.0-6.0
  • WordPress version: 6.3.1
  • First release: Feb 25, 2020
  • Latest release: Jun 26, 2022
  • Number of updates: 14
  • Update frequency: every 60.9 days
  • Top authors: DarkoG (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /519 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.22MB] [CPU: ▲3.24ms] Passed 4 tests

Server-side resources used by MKD Air Quality
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.68 ▲0.2246.15 ▲5.97
Dashboard /wp-admin3.57 ▲0.2756.18 ▲6.37
Posts /wp-admin/edit.php3.62 ▲0.2650.50 ▲0.35
Add New Post /wp-admin/post-new.php6.09 ▲0.2096.26 ▲0.45
Media Library /wp-admin/upload.php3.43 ▲0.2039.96 ▲6.17
AIR Quality (MK) /wp-admin/options-general.php?page=mkd-air-quality3.4033.97

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for MKD Air Quality
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.22 ▼1.531.94 ▲0.0744.90 ▼5.37
Dashboard /wp-admin2,213 ▲254.89 ▲0.00101.22 ▼8.5541.56 ▼4.87
Posts /wp-admin/edit.php2,090 ▼22.00 ▼0.0234.01 ▼7.9032.66 ▼2.96
Add New Post /wp-admin/post-new.php1,548 ▲3418.12 ▲0.47620.97 ▼54.2259.02 ▲6.33
Media Library /wp-admin/upload.php1,386 ▼24.23 ▲0.0396.34 ▼8.7940.19 ▼5.84
AIR Quality (MK) /wp-admin/options-general.php?page=mkd-air-quality8072.0224.8728.76

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 7 options
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • mkdaiq_settings
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget

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 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please take a closer look at the following
  • 3× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/wp-mkd-air-quality/admin/partials/mkd-air-quality-admin-display.php
    • > /wp-content/plugins/wp-mkd-air-quality/public/partials/linechart.php
    • > /wp-content/plugins/wp-mkd-air-quality/public/partials/map.php
  • 15× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: units_selector in wp-content/plugins/wp-mkd-air-quality/public/partials/map.php on line 10
    • > PHP Notice
      Undefined variable: station in wp-content/plugins/wp-mkd-air-quality/public/partials/linechart.php on line 18
    • > PHP Notice
      Undefined variable: unit in wp-content/plugins/wp-mkd-air-quality/public/partials/map.php on line 9
    • > PHP Notice
      Undefined variable: stations_selector in wp-content/plugins/wp-mkd-air-quality/public/partials/linechart.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-mkd-air-quality/public/partials/rank.php:45
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/wp-mkd-air-quality/includes/data/units.php:16
    • > PHP Notice
      Undefined variable: date in wp-content/plugins/wp-mkd-air-quality/public/partials/linechart.php on line 15
    • > PHP Notice
      Undefined variable: xlabels in wp-content/plugins/wp-mkd-air-quality/public/partials/linechart.php on line 14
    • > PHP Notice
      Undefined variable: stations_selector in wp-content/plugins/wp-mkd-air-quality/public/partials/linechart.php on line 20
    • > PHP Notice
      Undefined variable: timemode in wp-content/plugins/wp-mkd-air-quality/public/partials/linechart.php on line 17

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 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
3 plugin tags: macedonia, airquality, skopje

wp-mkd-air-quality/wp-mkd-air-quality.php Passed 13 tests

"MKD Air Quality" version 1.1.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
68 characters long description:
Show air quality data for multiple air quality stations in Macedonia

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
There were no executable files found in this plugin18,298 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript75,2626,95116,302
PHP222547911,164
CSS36124657
PO File16075135
Markdown125040

PHP code Passed 2 tests

Analyzing 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.29
Average class complexity8.33
▷ Minimum class complexity1.00
▷ Maximum class complexity35.00
Average method complexity2.57
▷ Minimum method complexity1.00
▷ Maximum method complexity24.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes12
▷ Abstract classes00.00%
▷ Concrete classes12100.00%
▷ Final classes00.00%
Methods56
▷ Static methods610.71%
▷ Public methods4682.14%
▷ Protected methods00.00%
▷ Private methods1017.86%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants13
▷ Global constants17.69%
▷ Class constants1292.31%
▷ Public constants12100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
5 compressed PNG files occupy 0.01MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/resources/leaflet/images/marker-icon-2x.png2.41KB2.52KB0.00%
public/resources/leaflet/images/layers.png0.68KB1.05KB0.00%
public/resources/leaflet/images/marker-icon.png1.43KB1.55KB0.00%
public/resources/leaflet/images/layers-2x.png1.23KB1.67KB0.00%
public/resources/leaflet/images/marker-shadow.png0.60KB1.16KB0.00%