84% carbon-offset

Code Review | Carbon Offset

WordPress plugin Carbon Offset scored84%from 54 tests.

About plugin

  • Plugin page: carbon-offset
  • Plugin version: 1.0.6
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.8
  • WordPress version: 6.3.1
  • First release: May 18, 2020
  • Latest release: Jun 30, 2021
  • Number of updates: 10
  • Update frequency: every 40.7 days
  • Top authors: aristath (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /1,455 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼4.38ms] Passed 4 tests

This is a short check of server-side resources used by Carbon Offset
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0342.93 ▼7.27
Dashboard /wp-admin3.32 ▲0.0248.13 ▼2.83
Posts /wp-admin/edit.php3.38 ▲0.0251.61 ▼1.81
Add New Post /wp-admin/post-new.php5.91 ▲0.0296.78 ▼5.61
Media Library /wp-admin/upload.php3.25 ▲0.0237.66 ▲1.86

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 12 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
carbon_offset
db_upgraded
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Carbon Offset
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲4713.27 ▼1.095.04 ▲3.0047.10 ▲2.86
Dashboard /wp-admin2,222 ▲374.85 ▼1.01100.22 ▼4.6240.86 ▼4.45
Posts /wp-admin/edit.php2,105 ▲162.03 ▼0.0140.22 ▲2.8635.89 ▲2.66
Add New Post /wp-admin/post-new.php1,560 ▲4118.10 ▼3.08601.46 ▼44.6169.20 ▲18.90
Media Library /wp-admin/upload.php1,404 ▲134.29 ▲0.0698.26 ▼3.6042.32 ▲0.35

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
Please fix the following items
  • The uninstall procedure has failed, leaving 7 options in the database
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • carbon_offset

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function CarbonOffset\\add_action() in wp-content/plugins/carbon-offset/inc/AdminPage.php:41
    • > PHP Fatal error
      Uncaught Error: Class 'CarbonOffset\\PaymentAPI' not found in wp-content/plugins/carbon-offset/inc/PaymentAPICloverly.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
4 plugin tags: carbon offset, ecology, greenhouse, green

carbon-offset/carbon-offset.php Passed 13 tests

The entry point to "Carbon Offset" version 1.0.6 is a PHP file that has certain tags in its header comment area
36 characters long description:
Offset your site's carbon footprint.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin651 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP9121611651

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity8.38
▷ Minimum class complexity1.00
▷ Maximum class complexity24.00
Average method complexity2.59
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes8
▷ Abstract classes112.50%
▷ Concrete classes787.50%
▷ Final classes00.00%
Methods39
▷ Static methods00.00%
▷ Public methods3282.05%
▷ Protected methods615.38%
▷ Private methods12.56%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/sponsors/wplemon.png2.65KB2.82KB0.00%