83% discussions-tab-for-woocommerce-products

Code Review | Discussions Tab for WooCommerce Products

WordPress plugin Discussions Tab for WooCommerce Products scored83%from 54 tests.

About plugin

  • Plugin page: discussions-tab-f...
  • Plugin version: 1.5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-6.3
  • WordPress version: 6.3.1
  • First release: Jul 20, 2017
  • Latest release: Oct 24, 2023
  • Number of updates: 62
  • Update frequency: every 36.9 days
  • Top authors: algoritmika (58.06%)Karzin (32.26%)wpcodefactory (12.9%)

Code review

54 tests

User reviews

1 review

Install metrics

50+ active /3,480 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.02MB] [CPU: ▼9.07ms] Passed 4 tests

A check of server-side resources used by Discussions Tab for WooCommerce Products
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0336.53 ▼1.21
Dashboard /wp-admin3.33 ▼0.0144.66 ▼17.35
Posts /wp-admin/edit.php3.44 ▲0.0944.82 ▼1.07
Add New Post /wp-admin/post-new.php5.91 ▲0.0384.90 ▼16.66
Media Library /wp-admin/upload.php3.25 ▲0.0332.64 ▼0.59

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 101 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by Discussions Tab for WooCommerce Products
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲4314.23 ▼0.321.70 ▲0.1240.63 ▼2.50
Dashboard /wp-admin2,198 ▲185.62 ▲0.0183.22 ▼14.1137.32 ▼3.53
Posts /wp-admin/edit.php2,103 ▲32.01 ▼0.0139.99 ▲6.2436.04 ▲0.69
Add New Post /wp-admin/post-new.php1,526 ▼023.20 ▼0.02674.79 ▲31.3955.27 ▼8.22
Media Library /wp-admin/upload.php1,400 ▲64.21 ▼0.0194.70 ▼3.7244.92 ▲1.03

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 75% 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
Almost there! Just fix the following items
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sanitize_text_field() in wp-content/plugins/discussions-tab-for-woocommerce-products/templates/dtwp-comments.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that require attention:
  • Tags: Please reduce the number of tags, currently 18 tag instead of maximum 10
  • Screenshots: Add an image for screenshot #1 (Display a Discussions tab in your product page.)
You can take inspiration from this readme.txt

discussions-tab-for-woocommerce-products/discussions-tab-for-woocommerce-products.php 92% from 13 tests

The main file in "Discussions Tab for WooCommerce Products" v. 1.5.1 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:
  • Requires at least: Required version must match the one declared in readme.txt ("4.4" instead of "3.0.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin8,708 lines of code in 81 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript331042834,855
PHP314791,8423,050
CSS61642494
Sass7111206
JSON400103

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity14.36
▷ Minimum class complexity1.00
▷ Maximum class complexity65.00
Average method complexity2.68
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces6
Interfaces0
Traits0
Classes22
▷ Abstract classes00.00%
▷ Concrete classes22100.00%
▷ Final classes14.55%
Methods176
▷ Static methods2011.36%
▷ Public methods17096.59%
▷ Protected methods31.70%
▷ Private methods31.70%
Functions14
▷ Named functions750.00%
▷ Anonymous functions750.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 compressed PNG file occupies 0.01MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/images/autofill-frontend.png5.47KB5.50KB0.00%