78% greenerwp

Code Review | GreenerWP

WordPress plugin GreenerWP scored78%from 54 tests.

About plugin

  • Plugin page: greenerwp
  • Plugin version: 0.2.4
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2.3-5.9
  • WordPress version: 6.3.1
  • First release: Dec 10, 2019
  • Latest release: Feb 15, 2022
  • Number of updates: 20
  • Update frequency: every 39.9 days
  • Top authors: cneumann (100%)

Code review

54 tests

User reviews

1 review

Install metrics

70+ active /2,324 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

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

A check of server-side resources used by GreenerWP
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.82 ▲0.3639.69 ▲3.53
Dashboard /wp-admin3.64 ▲0.2949.10 ▼7.60
Posts /wp-admin/edit.php3.70 ▲0.3452.93 ▲5.93
Add New Post /wp-admin/post-new.php6.25 ▲0.3689.97 ▼6.48
Media Library /wp-admin/upload.php3.57 ▲0.3444.09 ▲12.83
GreenerWP /wp-admin/admin.php?page=greenerwp3.4837.45
Settings /wp-admin/admin.php?page=greenerwp_settings3.4838.09
Recipes /wp-admin/admin.php?page=greenerwp_recipes3.4836.00

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 60 new files
Database: 1 new table, 8 new options
New tables
wp_greenerwp_page_views
New WordPress options
greenerwp_version
db_upgraded
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
widget_greenerwp_awareness_widget

Browser metrics Passed 4 tests

A check of browser resources used by GreenerWP
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,941 ▲19517.13 ▲2.743.09 ▲1.4438.23 ▼4.29
Dashboard /wp-admin2,290 ▲1027.95 ▲3.05233.53 ▲133.3641.82 ▲2.36
Posts /wp-admin/edit.php2,201 ▲1127.16 ▲5.1585.48 ▲48.6735.57 ▼2.13
Add New Post /wp-admin/post-new.php1,554 ▲1218.62 ▲0.21547.08 ▼99.1832.35 ▼20.01
Media Library /wp-admin/upload.php1,563 ▲1759.03 ▲4.75124.63 ▲28.6943.40 ▼2.57
GreenerWP /wp-admin/admin.php?page=greenerwp9046.8159.3734.78
Settings /wp-admin/admin.php?page=greenerwp_settings9406.7561.1627.90
Recipes /wp-admin/admin.php?page=greenerwp_recipes1,0857.4561.0134.87

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • widget_greenerwp_awareness_widget
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means 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
Almost there! Just fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/greenerwp/views/frontend/widgets/awareness.php
  • 14× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/greenerwp/views/admin/statistics.php:7
    • > PHP Notice
      Undefined variable: description in wp-content/plugins/greenerwp/views/frontend/widgets/awareness.php on line 9
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/greenerwp/src/UI/Frontend/Widgets/Awareness.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/greenerwp/views/admin/page.php:7
    • > PHP Notice
      Undefined variable: widget in wp-content/plugins/greenerwp/views/frontend/widgets/awareness-form.php on line 7
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/greenerwp/greenerwp-base.php on line 14
    • > PHP Fatal error
      Uncaught Error: Class 'GreenerWP\\Pimple' not found in wp-content/plugins/greenerwp/src/Plugin.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/greenerwp/views/admin/settings.php:7
    • > PHP Notice
      Undefined variable: plugin in wp-content/plugins/greenerwp/greenerwp-base.php on line 14
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_field_id() on null in wp-content/plugins/greenerwp/views/frontend/widgets/awareness-form.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 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
Please fix the following attributes:
  • Plugin Name: You should set the name of your plugin on the first line ( === greenerwp === )
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can take inspiration from this readme.txt

greenerwp/greenerwp.php Passed 13 tests

The principal PHP file in "GreenerWP" v. 0.2.4 is loaded by WordPress automatically on each request
71 characters long description:
Assists you in creating environmentally sustainable WordPress websites.

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
No dangerous file extensions were detected1,347 lines of code in 51 files:
LanguageFilesBlank linesComment linesLines of code
PHP442214151,265
JavaScript50580
CSS2022

PHP code Passed 2 tests

An overview 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.21
Average class complexity3.60
▷ Minimum class complexity1.00
▷ Maximum class complexity23.00
Average method complexity1.70
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces14
Interfaces0
Traits0
Classes30
▷ Abstract classes00.00%
▷ Concrete classes30100.00%
▷ Final classes00.00%
Methods109
▷ Static methods00.00%
▷ Public methods10899.08%
▷ Protected methods00.00%
▷ Private methods10.92%
Functions40
▷ Named functions615.00%
▷ Anonymous functions3485.00%
Constants4
▷ Global constants125.00%
▷ Class constants375.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG files were detected