68% wp-power-stats

Code Review | WP Power Stats

WordPress plugin WP Power Stats scored68%from 54 tests.

About plugin

  • Plugin page: wp-power-stats
  • Plugin version: 2.2.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-4.9
  • WordPress version: 6.3.1
  • First release: Dec 24, 2013
  • Latest release: Mar 12, 2018
  • Number of updates: 119
  • Update frequency: every 12.9 days
  • Top authors: artifex404 (100%)

Code review

54 tests

User reviews

54 reviews

Install metrics

9,000+ active /162,500 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.16MB] [CPU: ▼5.35ms] Passed 4 tests

Analyzing server-side resources used by WP Power Stats
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.56 ▲1.0947.49 ▲3.05
Dashboard /wp-admin4.51 ▲1.1655.91 ▼6.56
Posts /wp-admin/edit.php4.56 ▲1.2057.02 ▲3.77
Add New Post /wp-admin/post-new.php7.09 ▲1.2092.43 ▼21.67
Media Library /wp-admin/upload.php4.43 ▲1.2050.29 ▲9.35
Overview /wp-admin/admin.php?page=wp-power-stats-view-14.4752.10
Settings /wp-admin/admin.php?page=wp-power-stats-settings4.4343.29

Server storage [IO: ▲1.75MB] [DB: ▲0.01MB] Passed 3 tests

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 60 new files
Database: 7 new tables, 8 new options
New tables
wp_power_stats_pageviews
wp_power_stats_posts
wp_power_stats_searches
wp_power_stats_referers
wp_power_stats_browsers
wp_power_stats_visits
wp_power_stats_os
New WordPress options
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
db_upgraded
power_stats_internal
widget_theysaidso_widget
widget_recent-posts
widget_foo_widget

Browser metrics Passed 4 tests

Checking browser requirements for WP Power Stats
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,822 ▲6114.29 ▼0.062.25 ▲0.3046.51 ▲2.87
Dashboard /wp-admin2,221 ▲475.64 ▲0.0884.20 ▼9.6639.91 ▼8.43
Posts /wp-admin/edit.php2,123 ▲201.99 ▼0.0337.19 ▲0.9437.37 ▼0.74
Add New Post /wp-admin/post-new.php1,545 ▲1722.91 ▼0.18655.54 ▼23.4960.60 ▲2.05
Media Library /wp-admin/upload.php1,420 ▲204.14 ▲0.0096.87 ▼15.9243.72 ▼3.63
Overview /wp-admin/admin.php?page=wp-power-stats-view-12,16810.4280.0655.36
Settings /wp-admin/admin.php?page=wp-power-stats-settings9231.8426.4826.19

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • Zombie tables detected upon uninstall: 7 tables
    • wp_power_stats_posts
    • wp_power_stats_referers
    • wp_power_stats_os
    • wp_power_stats_searches
    • wp_power_stats_visits
    • wp_power_stats_pageviews
    • wp_power_stats_browsers
  • Zombie WordPress options detected upon uninstall: 8 options
    • widget_foo_widget
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • power_stats_internal
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
Almost there! Just fix the following items
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/wp-power-stats/admin/view/index.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/wp-power-stats/widget.php:6

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There are user-side issues you should fix
    • > GET request to /wp-admin/admin.php?page=wp-power-stats-view-1
    • > Console-api (warning) in unknown
    https://maps.googleapis.com/maps/api/js?key= 210:51 "Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see https://goo.gle/js-api-loading"

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Responsive design screenshots and some features listed.), #2 (Settings page.)
Please take inspiration from this readme.txt

wp-power-stats/wp-power-stats.php 92% from 13 tests

Analyzing the main PHP file in "WP Power Stats" version 2.2.3
The following require your attention:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin9,651 lines of code in 26 files:
LanguageFilesBlank linesComment linesLines of code
PHP137611,5828,376
PO File83843911,030
CSS35726192
JavaScript214053

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity93.14
▷ Minimum class complexity9.00
▷ Maximum class complexity217.00
Average method complexity4.39
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods190
▷ Static methods8846.32%
▷ Public methods11359.47%
▷ Protected methods7640.00%
▷ Private methods10.53%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants12
▷ Global constants18.33%
▷ Class constants1191.67%
▷ Public constants11100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
23 PNG files occupy 0.11MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/direct.png1.11KB0.26KB▼ 76.36%
screenshot-3.png16.74KB17.40KB0.00%
admin/images/desktop.png1.18KB0.34KB▼ 70.79%
admin/images/icon.png1.16KB0.29KB▼ 75.25%
admin/images/chrome.png2.21KB1.57KB▼ 29.15%