10% climate-friendly-cart

Code Review | Climate Friendly Cart

WordPress plugin Climate Friendly Cart scored10%from 54 tests.

About plugin

  • Plugin page: climate-friendly-...
  • Plugin version: 1.3.124
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Jan 1, 2021
  • Latest release: Feb 20, 2023
  • Number of updates: 73
  • Update frequency: every 10.7 days
  • Top authors: carbonclick (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

30+ active /5,574 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
You still need to fix the following installer errors
  • This plugin did not install gracefully
    • > Notice in wp-content/plugins/climate-friendly-cart/cfc-constant.php+46
    Trying to access array offset on value of type bool

Server metrics [RAM: ▼10.28MB] [CPU: ▼2,114,255.68ms] Passed 4 tests

This is a short check of server-side resources used by Climate Friendly Cart
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /44.48 ▲40.978,465,595.55 ▲8,465,547.75
Dashboard /wp-admin3.35 ▼41.1251.96 ▼8,457,010.66
Posts /wp-admin/edit.php3.40 ▲0.0058.13 ▲2.46
Add New Post /wp-admin/post-new.php5.93 ▲0.0089.11 ▼9.75
Media Library /wp-admin/upload.php3.27 ▲0.0038.66 ▼4.76

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 62 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
db_upgraded
widget_recent-comments
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for Climate Friendly Cart
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲4314.42 ▲0.131.70 ▼0.0443.94 ▲4.28
Dashboard /wp-admin2,195 ▲245.51 ▼0.1183.82 ▼4.1144.05 ▲2.43
Posts /wp-admin/edit.php2,100 ▼02.01 ▼0.0236.20 ▼1.4737.93 ▼2.22
Add New Post /wp-admin/post-new.php1,540 ▲1218.42 ▼4.61635.73 ▼33.2873.92 ▲25.33
Media Library /wp-admin/upload.php1,400 ▲34.21 ▲0.01100.66 ▼16.5641.75 ▼6.01

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin cannot be uninstalled
    • > Warning in wp-content/plugins/climate-friendly-cart/cfc-constant.php+7
    Use of undefined constant CFC_PLUGIN_FILE - assumed 'CFC_PLUGIN_FILE' (this will throw an Error in a future version of PHP)
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments

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)
Good news, no errors were detected

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
  • 3× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/climate-friendly-cart/includes/admin/class-cfc-admin-save-settings.php
    • > /wp-content/plugins/climate-friendly-cart/includes/admin/class-cfc-admin-init.php
    • > /wp-content/plugins/climate-friendly-cart/climate-friendly-cart.php
  • 16× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/climate-friendly-cart/includes/admin/views/climate-friendly-rewards.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'CFC_Carbonclick_Laravel_API' not found in wp-content/plugins/climate-friendly-cart/includes/admin/views/cfc-card-manager.php:2
    • > PHP Warning
      Use of undefined constant CFC_PLUGIN_PATH - assumed 'CFC_PLUGIN_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/climate-friendly-cart/includes/admin/views/onboarding/onboarding-step-1.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'CFC_Carbonclick_Laravel_API' not found in wp-content/plugins/climate-friendly-cart/includes/admin/views/dashboard.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/climate-friendly-cart/includes/admin/views/cfc-settings.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/climate-friendly-cart/includes/class-cfc-rewards-endpoint.php:5
    • > PHP Notice
      Undefined variable: active_step in wp-content/plugins/climate-friendly-cart/includes/admin/views/cfc-onboarding.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/climate-friendly-cart/includes/admin/views/admin-dashboard-page.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/climate-friendly-cart/includes/admin/views/onboarding/onboarding-step-2.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/climate-friendly-cart/cfc-constant.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Please fix the following attributes:
  • Plugin Name: Please specify the plugin name on the first line ( === Climate Friendly Cart === )
  • Tags: Please delete some tags, you are using 11 tag instead of maximum 10
You can look at the official readme.txt

climate-friendly-cart/climate-friendly-cart.php Passed 13 tests

The main file in "Climate Friendly Cart" v. 1.3.124 serves as a complement to information provided in readme.txt and as the entry point to the plugin
33 characters long description:
We make sustainable business easy

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin7,718 lines of code in 55 files:
LanguageFilesBlank linesComment linesLines of code
PHP371,3034965,112
CSS296221,900
SVG1301535
JavaScript24010164
Markdown1107

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity23.90
▷ Minimum class complexity1.00
▷ Maximum class complexity71.00
Average method complexity3.44
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes00.00%
▷ Concrete classes10100.00%
▷ Final classes00.00%
Methods94
▷ Static methods00.00%
▷ Public methods94100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants23
▷ Global constants23100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
4 compressed PNG files occupy 0.04MB
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/look-and-feel/cloud-black.png3.65KB3.86KB0.00%
assets/images/carbon-offset-thumbnail.png25.88KB21.58KB▼ 16.62%
assets/images/look-and-feel/cloud-white.png3.65KB3.86KB0.00%
assets/images/look-and-feel/cloud-standard.png3.65KB3.86KB0.00%