68% wpchargebee

Code Review | WP Chargebee

WordPress plugin WP Chargebee scored 68% from 54 tests.

About plugin

  • Plugin page: wpchargebee
  • Plugin version: 1.1
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.2
  • WordPress version: 6.3.1
  • First release: Jun 4, 2019
  • Latest release: Jun 5, 2019
  • Number of updates: 6
  • Update frequency: every 1.0 days
  • Top authors: thinkun (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,354 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼9.97ms] Passed 4 tests

Server-side resources used by WP Chargebee
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0036.37 ▼6.98
Dashboard /wp-admin3.31 ▲0.0044.62 ▼5.23
Posts /wp-admin/edit.php3.36 ▲0.0046.10 ▼4.33
Add New Post /wp-admin/post-new.php5.89 ▲0.0082.70 ▼23.31
Media Library /wp-admin/upload.php3.23 ▲0.0032.19 ▼4.37
Settings /wp-admin/admin.php?page=wpcb-settings3.0023.45
WPCB /wp-admin/admin.php?page=wpcb3.0022.48

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 169 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by WP Chargebee
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.18 ▼1.571.70 ▼0.2040.22 ▼5.48
Dashboard /wp-admin2,206 ▲184.87 ▼1.10106.83 ▲2.8038.73 ▼4.85
Posts /wp-admin/edit.php2,089 ▼02.05 ▼0.0039.65 ▲2.9234.71 ▲0.46
Add New Post /wp-admin/post-new.php1,533 ▼1123.24 ▲5.03655.30 ▼10.3350.38 ▼13.40
Media Library /wp-admin/upload.php1,388 ▼04.23 ▲0.0697.87 ▼10.6739.98 ▼7.42
Settings /wp-admin/admin.php?page=wpcb-settings280.440.103.68
WPCB /wp-admin/admin.php?page=wpcb280.440.095.26

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

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
The following issues need your attention
  • 141× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/PlanEventBasedAddon.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/SubscriptionCoupon.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/ExportDownload.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/CreditNoteDiscount.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/InvoiceLineItem.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/CouponSet.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/CreditNoteLineItem.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/CustomerBalance.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/InvoiceDiscount.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ChargeBee_Model' not found in wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ChargeBee/Models/SubscriptionEstimate.php:3

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=wpcb-settings
    • > Network (severe)
    wp-admin/admin.php?page=wpcb-settings - Failed to load resource: the server responded with a status of 403 (Forbidden)
    • > GET request to /wp-admin/admin.php?page=wpcb
    • > Network (severe)
    wp-admin/admin.php?page=wpcb - Failed to load resource: the server responded with a status of 403 (Forbidden)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Donate link: Invalid URI found ("")
  • Screenshots: Please add images for these screenshots: #1 (WPCB_plans.jpg), #2 (WPCB_plans_edge cases.jpg)
You can take inspiration from this readme.txt

wpchargebee/wp-chargebee.php 92% from 13 tests

Analyzing the main PHP file in "WP Chargebee" version 1.1
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wpchargebee.php" instead of "wp-chargebee.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
It is important to fix the following items
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/wpchargebee/vendor/chargebee/chargebee-php/lib/ssl/ca-certs.crt
5,460 lines of code in 163 files:
LanguageFilesBlank linesComment linesLines of code
PHP1521,1183044,100
Markdown252601,029
JavaScript3191158
CSS213995
JSON40078

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity2.19
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity1.43
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes139
▷ Abstract classes10.72%
▷ Concrete classes13899.28%
▷ Final classes10.72%
Methods391
▷ Static methods26868.54%
▷ Public methods38598.47%
▷ Protected methods00.00%
▷ Private methods61.53%
Functions14
▷ Named functions1178.57%
▷ Anonymous functions321.43%
Constants4
▷ Global constants00.00%
▷ Class constants4100.00%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There were not PNG files found in your plugin