10% wp-energy-usage-calculator

Code Review | WP Energy Usage Calculator

WordPress plugin WP Energy Usage Calculator scored10%from 54 tests.

About plugin

  • Plugin page: wp-energy-usage-c...
  • Plugin version: 0.1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.0
  • WordPress version: 6.3.1
  • First release: Dec 29, 2016
  • Latest release: Jan 23, 2019
  • Number of updates: 14
  • Update frequency: every 53.8 days
  • Top authors: nicholaskajoh (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /2,682 total downloads

Benchmarks

Plugin footprint 23% 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
The following installer errors require your attention
  • The plugin cannot be installed
    • > Notice in wp-content/plugins/wp-energy-usage-calculator/class-wpeuc.php+23
    Trying to access array offset on value of type bool

Server metrics [RAM: ▼1.89MB] [CPU: ▼54.41ms] Passed 4 tests

A check of server-side resources used by WP Energy Usage Calculator
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.09 ▼1.374.84 ▼38.93
Dashboard /wp-admin2.11 ▼1.198.07 ▼45.26
Posts /wp-admin/edit.php2.11 ▼1.247.11 ▼42.32
Add New Post /wp-admin/post-new.php2.11 ▼3.777.56 ▼91.14
Media Library /wp-admin/upload.php2.11 ▼1.126.91 ▼27.35
WP Energy Usage Calculator /wp-admin/options-general.php?page=wpeuc-settings2.117.89

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 17 new files
Database: 1 new table, 6 new options
New tables
wp_wpeuc_data
New WordPress options
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for WP Energy Usage Calculator
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,926 ▲18014.17 ▼0.217.57 ▲5.6539.50 ▼4.85
Dashboard /wp-admin2,222 ▲345.00 ▲0.12110.19 ▼4.2541.46 ▼4.52
Posts /wp-admin/edit.php2,102 ▲132.22 ▲0.2338.25 ▲3.9333.84 ▼0.90
Add New Post /wp-admin/post-new.php1,525 ▲1117.74 ▲0.16638.29 ▲0.7859.64 ▲12.64
Media Library /wp-admin/upload.php1,398 ▲164.38 ▲0.1795.57 ▼7.0743.36 ▲0.96
WP Energy Usage Calculator /wp-admin/options-general.php?page=wpeuc-settings9092.1623.9945.64

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/wp-energy-usage-calculator/class-wpeuc.php+23
    Trying to access array offset on value of type bool
  • Zombie tables detected upon uninstall: 1 table
    • wp_wpeuc_data
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options

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
These errors were triggered by the plugin
  • 36 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wpeuc-settings
    • > Notice in wp-content/plugins/wp-energy-usage-calculator/admin/class-wpeuc-admin.php+70
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/options-general.php?page=wpeuc-settings
    • > 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.)

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
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WPEUC' not found in wp-content/plugins/wp-energy-usage-calculator/admin/class-wpeuc-admin.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WPEUC' not found in wp-content/plugins/wp-energy-usage-calculator/public/class-wpeuc-public.php:6
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/wp-energy-usage-calculator/public/wpeuc-public-view.php:18
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/wp-energy-usage-calculator/admin/wpeuc-admin-view.php:18

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

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes:
  • Plugin Name: Please specify the plugin name on the first line ( === wp-energy-usage-calculator === )
The official readme.txt might help

wp-energy-usage-calculator/wpeuc.php 77% from 13 tests

The main PHP script in "WP Energy Usage Calculator" version 0.1.2 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Text Domain: Please use dashes and lowercase characters for text domains
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("wp-energy-usage-calculator.php" instead of "wpeuc.php")
  • Domain Path: The domain path is invalid: folder "/languages" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Everything looks great! No dangerous files found in this plugin1,867 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
CSS3081,518
PHP776136289
JavaScript3183360

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.07
Average class complexity2.00
▷ Minimum class complexity1.00
▷ Maximum class complexity4.00
Average method complexity1.12
▷ Minimum method complexity1.00
▷ Maximum method complexity2.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods24
▷ Static methods00.00%
▷ Public methods24100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants00.00%
▷ Class constants2100.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG files were detected