83% cost-centre-gateway-for-woocommerce

Code Review | Cost Centre Gateway for WooCommerce

WordPress plugin Cost Centre Gateway for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: cost-centre-gatew...
  • Plugin version: 1.1.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.4
  • WordPress version: 6.3.1
  • First release: Mar 12, 2020
  • Latest release: Mar 12, 2020
  • Number of updates: 2
  • Update frequency: every 0.5 days
  • Top authors: mbezuidenhout (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /407 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▼0.18MB] [CPU: ▼9.10ms] Passed 4 tests

An overview of server-side resources used by Cost Centre Gateway for WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0239.80 ▼3.68
Dashboard /wp-admin3.31 ▲0.0148.44 ▼3.74
Posts /wp-admin/edit.php3.37 ▲0.0153.30 ▲4.19
Add New Post /wp-admin/post-new.php5.15 ▼0.7463.62 ▼33.15
Media Library /wp-admin/upload.php3.24 ▲0.0145.88 ▲7.62

Server storage [IO: ▲0.05MB] [DB: ▲0.07MB] Passed 3 tests

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

Browser metrics Passed 4 tests

Cost Centre Gateway for WooCommerce: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.30 ▼0.051.73 ▼0.1944.22 ▼0.05
Dashboard /wp-admin2,195 ▲185.56 ▼0.1486.13 ▼2.7837.88 ▼3.96
Posts /wp-admin/edit.php2,100 ▼01.99 ▼0.0234.48 ▼1.6733.12 ▼4.64
Add New Post /wp-admin/post-new.php45 ▼1,4840.44 ▼17.080.09 ▼640.799.57 ▼45.63
Media Library /wp-admin/upload.php1,403 ▲34.26 ▲0.0495.68 ▼0.8665.21 ▲25.57

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • recovery_mode_email_last_sent
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 75% 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 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cost-centre-gateway-for-woocommerce/includes/class-woo-costcentre-gateway-admin.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/cost-centre-gateway-for-woocommerce/includes/class-wc-gateway-costcentre.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed:
  • Plugin Name: You should set the name of your plugin on the first line ( === cost-centre-gateway-for-woocommerce === )
Please take inspiration from this readme.txt

cost-centre-gateway-for-woocommerce/woo-costcentre-gateway.php 77% from 13 tests

The principal PHP file in "Cost Centre Gateway for WooCommerce" v. 1.1.1 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("cost-centre-gateway-for-woocommerce.php" instead of "woo-costcentre-gateway.php")
  • Requires at least: Required version does not match the one declared in readme.txt ("3.7" instead of "5.0")

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
There were no executable files found in this plugin414 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP15127625413
SVG1001

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity5.44
▷ Minimum class complexity1.00
▷ Maximum class complexity23.00
Average method complexity2.14
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods35
▷ Static methods38.57%
▷ Public methods3188.57%
▷ Protected methods00.00%
▷ Private methods411.43%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There were not PNG files found in your plugin