66% cedcommerce-onbuy-integration

Code Review | OnBuy Integration for WooCommerce

WordPress plugin OnBuy Integration for WooCommerce scored66%from 54 tests.

About plugin

  • Plugin page: cedcommerce-onbuy...
  • Plugin version: 2.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.0
  • WordPress version: 6.3.1
  • First release: Jul 11, 2020
  • Latest release: Jul 15, 2022
  • Number of updates: 20
  • Update frequency: every 37.9 days
  • Top authors: cedcommerce (100%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active /2,771 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.01MB] [CPU: ▼8.43ms] Passed 4 tests

This is a short check of server-side resources used by OnBuy Integration for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0037.91 ▼2.43
Dashboard /wp-admin3.31 ▼0.0448.74 ▼17.30
Posts /wp-admin/edit.php3.36 ▲0.0049.73 ▼3.78
Add New Post /wp-admin/post-new.php5.89 ▲0.0085.79 ▼10.20
Media Library /wp-admin/upload.php3.23 ▲0.0038.39 ▲3.98

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 58 new files
Database: 3 new tables, 6 new options
New tables
wp_ced_onbuy_accounts
wp_ced_onbuy_profiles
wp_ced_onbuy_queue
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by OnBuy Integration for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲4314.24 ▼0.131.85 ▲0.1741.91 ▲3.33
Dashboard /wp-admin2,198 ▲215.61 ▼0.0684.78 ▼15.3339.34 ▼3.63
Posts /wp-admin/edit.php2,097 ▼31.98 ▼0.0432.69 ▼8.9636.81 ▲0.50
Add New Post /wp-admin/post-new.php1,526 ▼023.01 ▲1.92686.89 ▲76.5366.33 ▲12.42
Media Library /wp-admin/upload.php1,403 ▲34.20 ▼0.05103.57 ▲3.2044.95 ▼2.01

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 3 tables in the database
    • wp_ced_onbuy_accounts
    • wp_ced_onbuy_profiles
    • wp_ced_onbuy_queue
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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
The following issues need your attention
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/cedcommerce-onbuy-integration/admin/partials/onbuy-integration-for-woocommerce-admin-display.php
    • > /wp-content/plugins/cedcommerce-onbuy-integration/public/partials/onbuy-integration-for-woocommerce-public-display.php
  • 3× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_posts() in wp-content/plugins/cedcommerce-onbuy-integration/admin/partials/ced-onbuy-product-metakeys-attributes.php:9
    • > PHP Notice
      Undefined variable: product_name in wp-content/plugins/cedcommerce-onbuy-integration/admin/partials/ced-onbuy-product-metakeys-attributes.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wc_get_product() in wp-content/plugins/cedcommerce-onbuy-integration/admin/partials/ced-onbuy-metakeys-list.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 94% 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
These attributes need your attention: The official readme.txt is a good inspiration

cedcommerce-onbuy-integration/onbuy-integration-for-woocommerce.php 69% from 13 tests

The main file in "OnBuy Integration for WooCommerce" v. 2.0.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("cedcommerce-onbuy-integration.php" instead of "onbuy-integration-for-woocommerce.php")
  • Description: The description should be shorter than 140 characters (currently 144 characters long)
  • Requires at least: Required version does not match the one declared in readme.txt ("4.7" instead of "3.0")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected12,050 lines of code in 44 files:
LanguageFilesBlank linesComment linesLines of code
PHP361,2051,5969,046
CSS3337421,634
JavaScript3107631,031
JSON100332
XML1007

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 207)
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity83.22
▷ Minimum class complexity1.00
▷ Maximum class complexity676.00
Average method complexity7.30
▷ Minimum method complexity1.00
▷ Maximum method complexity207.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes18
▷ Abstract classes00.00%
▷ Concrete classes18100.00%
▷ Final classes00.00%
Methods235
▷ Static methods72.98%
▷ Public methods22997.45%
▷ Protected methods10.43%
▷ Private methods52.13%
Functions20
▷ Named functions20100.00%
▷ Anonymous functions00.00%
Constants16
▷ Global constants16100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
5 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/icon.png9.15KB0.80KB▼ 91.21%
admin/images/ced-logo.png1.64KB0.78KB▼ 52.45%
admin/images/logo.png0.93KB0.87KB▼ 6.90%
(invalid) admin/images/onbuy-card.png9.32KB0.00KB▼ 100.00%
admin/images/logo1.png0.41KB0.42KB0.00%