56% hdcommerce

Code Review | HDCommerce

WordPress plugin HDCommerce scored56%from 54 tests.

About plugin

  • Plugin page: hdcommerce
  • Plugin version: 0.8
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8.0-5.3.2
  • WordPress version: 6.3.1
  • First release: Apr 26, 2018
  • Latest release: Mar 21, 2020
  • Number of updates: 12
  • Update frequency: every 57.9 days
  • Top authors: Harmonic_Design (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /847 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲0.62MB] [CPU: ▲3.45ms] 75% from 4 tests

An overview of server-side resources used by HDCommerce
Please fix the following
  • CPU: Try to keep total CPU usage under 500.00ms (currently 1,281.48ms on /wp-admin/admin.php?page=hdc_addons)
PageMemory (MB)CPU Time (ms)
Home /4.11 ▲0.6545.73 ▲6.46
Dashboard /wp-admin3.96 ▲0.6655.98 ▲7.45
Posts /wp-admin/edit.php4.01 ▲0.6648.83 ▲2.62
Add New Post /wp-admin/post-new.php6.48 ▲0.6093.91 ▲1.46
Media Library /wp-admin/upload.php3.81 ▲0.5938.39 ▲3.26
Orders /wp-admin/edit.php?post_type=hdc_orders3.8638.16
Coupons /wp-admin/edit.php?post_type=hdc_coupon3.8649.33
Product Categories /wp-admin/edit-tags.php?taxonomy=hdc_products&post_type=hdc_product3.8135.24
Add New Product /wp-admin/post-new.php?post_type=hdc_product4.1249.27
All Products /wp-admin/edit.php?post_type=hdc_product3.8639.10
HDCommerce /wp-admin/admin.php?page=hdc_options3.7634.95
Addons /wp-admin/admin.php?page=hdc_addons3.781,281.48

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 222 new files
Database: no new tables, 11 new options
New WordPress options
hdc_store_page
widget_recent-comments
widget_recent-posts
HDC_PLUGIN_VERSION
recovery_mode_email_last_sent
theysaidso_admin_options
can_compress_scripts
hdc_checkout_page
db_upgraded
hdc_payment_page
...

Browser metrics Passed 4 tests

Checking browser requirements for HDCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,939 ▲20413.19 ▼1.271.67 ▼0.3345.45 ▼1.71
Dashboard /wp-admin2,327 ▲1365.91 ▲1.02104.89 ▲1.0267.38 ▲28.04
Posts /wp-admin/edit.php2,153 ▲641.98 ▼0.0636.98 ▼2.6433.67 ▼3.41
Add New Post /wp-admin/post-new.php1,567 ▲3423.16 ▼0.07783.52 ▲184.1661.93 ▲19.60
Media Library /wp-admin/upload.php1,452 ▲644.13 ▼0.16106.03 ▲7.7943.91 ▲2.96
Orders /wp-admin/edit.php?post_type=hdc_orders1,1092.0732.7128.35
Coupons /wp-admin/edit.php?post_type=hdc_coupon1,1201.9941.7445.46
Product Categories /wp-admin/edit-tags.php?taxonomy=hdc_products&post_type=hdc_product1,3262.1426.1731.31
Add New Product /wp-admin/post-new.php?post_type=hdc_product2,5158.43197.93245.12
All Products /wp-admin/edit.php?post_type=hdc_product1,1341.9433.8827.70
HDCommerce /wp-admin/admin.php?page=hdc_options4,8222.3447.1546.97
Addons /wp-admin/admin.php?page=hdc_addons7661.146.7218.06

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 11 options
    • theysaidso_admin_options
    • HDC_PLUGIN_VERSION
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • hdc_store_page
    • db_upgraded
    • hdc_checkout_page
    • widget_recent-comments
    • recovery_mode_email_last_sent
    • ...

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=hdc_product
    • > Notice in wp-content/plugins/hdcommerce/includes/product-edit/fields/variations.php+84
    Trying to access array offset on value of type null
    • > GET request to /wp-admin/admin.php?page=hdc_options
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)
    • > GET request to /wp-admin/admin.php?page=hdc_addons
    • > Error in wp-content/plugins/hdcommerce/includes/addons.php+56
    Uncaught Error: Cannot use object of type stdClass as array in wp-content/plugins/hdcommerce/includes/addons.php:56
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): hdc_create_addons_page()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/admin.php(259): do_action()
    #4 {main}
    thrown

SRP 0% 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 fix the following items
  • 11× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/update_certs.php
    • > /wp-content/plugins/hdcommerce/includes/settings/settings_advanced.php
    • > /wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/build.php
    • > /wp-content/plugins/hdcommerce/includes/settings/settings_main.php
    • > /wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/examples/oauth.php
    • > /wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/tests/bootstrap.no_autoload.php
    • > /wp-content/plugins/hdcommerce/includes/templates/cart.php
    • > /wp-content/plugins/hdcommerce/includes/settings/settings_support.php
    • > /wp-content/plugins/hdcommerce/includes/settings/settings_custom_meta.php
    • > /wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/tests/bootstrap.php
  • 199× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Error\\Base' not found in wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/lib/Error/Api.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/tests/Stripe/BitcoinReceiverTest.php:5
    • > PHP Notice
      Undefined variable: hdc_disable_reviews in wp-content/plugins/hdcommerce/includes/settings/settings_advanced.php on line 64
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_style() in wp-content/plugins/hdcommerce/includes/meta/meta_orders_export.php:7
    • > PHP Notice
      Undefined variable: hdc_store_city in wp-content/plugins/hdcommerce/includes/settings/settings_main.php on line 57
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/tests/Stripe/StripeObjectTest.php:5
    • > PHP Notice
      Undefined variable: hdc_featured_image_h in wp-content/plugins/hdcommerce/includes/settings/settings_advanced.php on line 45
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/lib/Customer.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/tests/Stripe/Error/SignatureVerificationTest.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sanitize_text_field() in wp-content/plugins/hdcommerce/includes/shipping/usps/usps.php:21

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
These are user-side errors you should fix
    • > GET request to /wp-admin/edit.php?post_type=hdc_orders
    • > Javascript (severe) in unknown
    /wp-admin/edit.php?post_type=hdc_orders 45:15 Uncaught SyntaxError: Invalid or unexpected token

Optimizations

Plugin configuration 97% 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
Attributes that require attention:
  • Tags: Please reduce the number of tags, currently 11 tag instead of maximum 10
Please take inspiration from this readme.txt

hdcommerce/hdcommerce.php Passed 13 tests

"HDCommerce" version 0.8's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
34 characters long description:
The ultimate eCommerce experience.

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
These items require your attention
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/hdcommerce/includes/payment-gateways/stripe/6/data/ca-certificates.crt
20,380 lines of code in 208 files:
LanguageFilesBlank linesComment linesLines of code
PHP1942,5482,85914,225
CSS4536332,864
JavaScript33322412,761
Markdown21920428
JSON10036
YAML27136
XML20030

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity3.35
▷ Minimum class complexity1.00
▷ Maximum class complexity54.00
Average method complexity1.48
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces6
Interfaces2
Traits7
Classes122
▷ Abstract classes75.74%
▷ Concrete classes11594.26%
▷ Final classes00.00%
Methods593
▷ Static methods11419.22%
▷ Public methods55192.92%
▷ Protected methods172.87%
▷ Private methods254.22%
Functions169
▷ Named functions16396.45%
▷ Anonymous functions63.55%
Constants63
▷ Global constants711.11%
▷ Class constants5688.89%
▷ Public constants56100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 compressed PNG files occupy 0.00MB
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/payment-gateways/stripe/6/tests/data/test.png0.09KB0.09KB0.00%
includes/images/logo-16.png0.44KB0.44KB0.00%