68% sweet-energy-efficiency

Code Review | Sweet Energy Efficiency

WordPress plugin Sweet Energy Efficiency scored68%from 54 tests.

About plugin

  • Plugin page: sweet-energy-effi...
  • Plugin version: 1.0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.2
  • WordPress version: 6.3.1
  • First release: Dec 3, 2020
  • Latest release: Apr 14, 2023
  • Number of updates: 13
  • Update frequency: every 66.3 days
  • Top authors: listingthemes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

70+ active /1,088 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: ▲0.13MB] [CPU: ▼7.75ms] Passed 4 tests

A check of server-side resources used by Sweet Energy Efficiency
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0642.05 ▲1.32
Dashboard /wp-admin3.48 ▲0.1746.89 ▼7.32
Posts /wp-admin/edit.php3.51 ▲0.1652.50 ▲1.15
Add New Post /wp-admin/post-new.php6.13 ▲0.2480.18 ▼19.26
Media Library /wp-admin/upload.php3.35 ▲0.1331.62 ▼5.55
Add Graph /wp-admin/admin.php?page=see_add_graph3.3634.00
Manage Graphs /wp-admin/admin.php?page=sweet-energy-efficiency3.3635.86
Contact Us /wp-admin/admin.php?page=see_contact3.3335.98

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 118 new files
Database: 1 new table, 9 new options
New tables
wp_see_graph
New WordPress options
winter_mvc_active_plugins
can_compress_scripts
see_db_version
db_upgraded
widget_recent-posts
widget_see_graph_widget
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Sweet Energy Efficiency
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,964 ▲21814.06 ▼0.314.89 ▲3.0443.85 ▲1.06
Dashboard /wp-admin2,259 ▲684.97 ▲0.11108.53 ▲4.4539.30 ▲0.22
Posts /wp-admin/edit.php2,150 ▲612.29 ▲0.2739.21 ▼2.4831.65 ▼7.85
Add New Post /wp-admin/post-new.php1,563 ▲4917.86 ▲0.47647.03 ▼44.5934.00 ▼19.67
Media Library /wp-admin/upload.php1,447 ▲594.39 ▲0.15103.21 ▲1.3443.11 ▼2.18
Add Graph /wp-admin/admin.php?page=see_add_graph1,1372.5946.7730.59
Manage Graphs /wp-admin/admin.php?page=sweet-energy-efficiency1,9232.9098.2758.76
Contact Us /wp-admin/admin.php?page=see_contact9931.9027.9429.41

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • Zombie tables detected upon uninstall: 1 table
    • wp_see_graph
  • The uninstall procedure has failed, leaving 9 options in the database
    • db_upgraded
    • see_db_version
    • can_compress_scripts
    • widget_recent-comments
    • widget_see_graph_widget
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • winter_mvc_active_plugins
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
The following issues need your attention
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/sweet-energy-efficiency/public/partials/sweet-energy-efficiency-public-display.php
    • > /wp-content/plugins/sweet-energy-efficiency/admin/partials/sweet-energy-efficiency-admin-display.php
  • 11× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/sweet-energy-efficiency/elementor-elements/views/energy-efficiency.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sweet-energy-efficiency/elementor-elements/elementor-init.php:213
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/sweet-energy-efficiency/application/views/see_contact/index.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/sweet-energy-efficiency/application/views/sweet-energy-efficiency/index.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/sweet-energy-efficiency/vendor/Winter_MVC/init.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/sweet-energy-efficiency/widgets/see_graph.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'CI_Model' not found in wp-content/plugins/sweet-energy-efficiency/application/core/MY_Model.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/sweet-energy-efficiency/application/views/see_add_graph/index.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/sweet-energy-efficiency/shortcodes/see_graph.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wmvc_show_data() in wp-content/plugins/sweet-energy-efficiency/application/views/layouts/basic.php:1

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 97% 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
Attributes that require attention:
  • Screenshots: These screenshots do not have images: #1 (Manage Energy Efficient Graphs), #2 (Edit Energy Efficient Graph), #3 (Example Energy Efficient Graph in Widget)
Please take inspiration from this readme.txt

sweet-energy-efficiency/sweet-energy-efficiency.php Passed 13 tests

The main PHP file in "Sweet Energy Efficiency" ver. 1.0.5 adds more information about the plugin and also serves as the entry point for this plugin
110 characters long description:
Graphically Visually present Energy Efficiency Class / Label / Rating / Scale with related consumption values.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected23,440 lines of code in 74 files:
LanguageFilesBlank linesComment linesLines of code
SVG4088,421
CSS15892646,138
PHP391,9151,9515,982
JavaScript137508212,696
Markdown1140191
HTML1209
Sass1003

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity16.36
▷ Minimum class complexity1.00
▷ Maximum class complexity110.00
Average method complexity2.57
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes25
▷ Abstract classes00.00%
▷ Concrete classes25100.00%
▷ Final classes00.00%
Methods241
▷ Static methods62.49%
▷ Public methods21689.63%
▷ Protected methods104.15%
▷ Private methods156.22%
Functions114
▷ Named functions11197.37%
▷ Anonymous functions32.63%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.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
5 compressed PNG files occupy 0.00MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/img/details_open.png0.69KB0.80KB0.00%
admin/img/details_close.png0.67KB0.79KB0.00%
admin/resources/details_close.png0.67KB0.79KB0.00%
admin/resources/details_open.png0.69KB0.80KB0.00%
admin/resources/logo.png0.74KB0.87KB0.00%