67% custom-product-type-for-woocommerce

Code Review | Custom Product Type For WooCommerce

WordPress plugin Custom Product Type For WooCommerce scored67%from 54 tests.

About plugin

  • Plugin page: custom-product-ty...
  • Plugin version: 1.2.3
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8.0-6.3
  • WordPress version: 6.3.1
  • First release: Feb 25, 2021
  • Latest release: Sep 21, 2023
  • Number of updates: 85
  • Update frequency: every 11.0 days
  • Top authors: arabianmido (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

100+ active /2,901 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.58MB] [CPU: ▲0.54ms] 75% from 4 tests

An overview of server-side resources used by Custom Product Type For WooCommerce
Please have a look at the following items
  • CPU: You should keep total CPU usage under 500.00ms (currently 1,833.86ms on /wp-admin/options-general.php?page=cwpt-settings)
PageMemory (MB)CPU Time (ms)
Home /4.07 ▲0.6044.11 ▲5.28
Dashboard /wp-admin3.91 ▲0.5662.26 ▲0.24
Posts /wp-admin/edit.php3.96 ▲0.6050.28 ▲2.15
Add New Post /wp-admin/post-new.php6.44 ▲0.5692.08 ▼5.51
Media Library /wp-admin/upload.php3.83 ▲0.6045.06 ▲5.89
Product Types /wp-admin/options-general.php?page=cwpt-settings3.911,833.86
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius4.0041.82

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 436 new files
Database: no new tables, 9 new options
New WordPress options
widget_recent-posts
fs_active_plugins
fs_accounts
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_theysaidso_widget
widget_recent-comments
fs_debug_mode

Browser metrics Passed 4 tests

Custom Product Type For WooCommerce: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲2814.34 ▼0.271.65 ▼0.0433.17 ▼10.67
Dashboard /wp-admin2,220 ▲495.61 ▲0.0189.13 ▼3.6443.07 ▲2.10
Posts /wp-admin/edit.php2,126 ▲262.02 ▲0.0138.67 ▲2.7436.49 ▼3.07
Add New Post /wp-admin/post-new.php1,538 ▲723.28 ▲0.50659.61 ▼7.3869.13 ▲11.32
Media Library /wp-admin/upload.php1,422 ▲194.27 ▲0.15102.99 ▼2.8547.08 ▲2.13
Product Types /wp-admin/options-general.php?page=cwpt-settings9851.7326.7959.27
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,0772.0729.7928.92

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/custom-product-type-for-woocommerce/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • The uninstall procedure has failed, leaving 9 options in the database
    • db_upgraded
    • fs_accounts
    • can_compress_scripts
    • widget_theysaidso_widget
    • fs_debug_mode
    • theysaidso_admin_options
    • fs_active_plugins
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

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
  • 5× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/templates/media.php
    • > /wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/templates/image-advanced.php
    • > /wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/templates/audio.php
    • > /wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/templates/upload.php
    • > /wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/templates/video.php
  • 67× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Field' not found in wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/fields/custom-html.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_action() in wp-content/plugins/custom-product-type-for-woocommerce/includes/front/fields.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Object_Choice_Field' not found in wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/fields/user.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Choice_Field' not found in wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/fields/object-choice.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Field' not found in wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/fields/choice.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Input_Field' not found in wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/fields/number.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Multiple_Values_Field' not found in wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/fields/text-list.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Media_Field' not found in wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/fields/video.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Field' not found in wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/fields/textarea.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/custom-product-type-for-woocommerce/meta-box/inc/about/sections/upgrade.php:10

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 93% 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
Attributes that require attention: The official readme.txt might help

custom-product-type-for-woocommerce/custom-woocommerce-product-type.php 92% from 13 tests

The entry point to "Custom Product Type For WooCommerce" version 1.2.3 is a PHP file that has certain tags in its header comment area
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("custom-product-type-for-woocommerce.php" instead of "custom-woocommerce-product-type.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected44,005 lines of code in 373 files:
LanguageFilesBlank linesComment linesLines of code
PHP2189,15721,53539,204
JavaScript1005685172,414
CSS521521232,023
Markdown1680214
PO File14956145
SVG1005

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
Please tend to the following items
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.58
Average class complexity39.71
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.03
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes130
▷ Abstract classes86.15%
▷ Concrete classes12293.85%
▷ Final classes00.00%
Methods1,708
▷ Static methods48528.40%
▷ Public methods1,27174.41%
▷ Protected methods452.63%
▷ Private methods39222.95%
Functions120
▷ Named functions11696.67%
▷ Anonymous functions43.33%
Constants151
▷ Global constants10468.87%
▷ Class constants4731.13%
▷ Public constants47100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
17 compressed PNG files occupy 0.06MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
meta-box/img/jqueryui/ui-bg_glass_75_e6e6e6_1x400.png0.11KB0.14KB0.00%
meta-box/img/jqueryui/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
meta-box/img/jqueryui/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%
meta-box/img/jqueryui/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%
meta-box/img/jqueryui/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%