78% wp-discourse

Code Review | WP Discourse

WordPress plugin WP Discourse scored78%from 54 tests.

About plugin

  • Plugin page: wp-discourse
  • Plugin version: 2.4.9
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.1-6.1
  • WordPress version: 6.3.1
  • First release: Jul 5, 2016
  • Latest release: Mar 10, 2023
  • Number of updates: 306
  • Update frequency: every 8.0 days
  • Top authors: scossar (98.04%)Jailyard90Grad (2.29%)

Code review

54 tests

User reviews

8 reviews

Install metrics

1,000+ active /98,023 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲2.69MB] [CPU: ▲13.22ms] Passed 4 tests

Analyzing server-side resources used by WP Discourse
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /5.06 ▲1.6053.76 ▲10.88
Dashboard /wp-admin6.38 ▲3.0868.09 ▲22.74
Posts /wp-admin/edit.php6.43 ▲3.0764.27 ▲16.93
Add New Post /wp-admin/post-new.php8.96 ▲3.0899.20 ▲2.32
Media Library /wp-admin/upload.php6.24 ▲3.0160.92 ▲29.23
Text Content /wp-admin/admin.php?page=text_content_options6.2151.53
Connection /wp-admin/admin.php?page=connection_options6.2150.91
DiscourseConnect /wp-admin/admin.php?page=sso_options6.2152.18
Publishing /wp-admin/admin.php?page=publishing_options6.2151.92
All Options /wp-admin/admin.php?page=wp_discourse_options6.2150.14
Webhooks /wp-admin/admin.php?page=webhook_options6.2150.21
Logs /wp-admin/admin.php?page=log_viewer6.2149.19
Commenting /wp-admin/admin.php?page=commenting_options6.2151.13

Server storage [IO: ▲5.09MB] [DB: ▲0.01MB] Passed 3 tests

Filesystem and database footprint
This plugin installed successfully
Filesystem: 160 new files
Database: no new tables, 19 new options
New WordPress options
discourse_configurable_text
widget_recent-posts
discourse_webhook
wpdc_discourse_domain
discourse_sso_client
db_upgraded
discourse_configurable_text_backup
discourse_sso_common
discourse_connect
discourse_sso_provider
...

Browser metrics Passed 4 tests

A check of browser resources used by WP Discourse
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,885 ▲13914.78 ▲0.031.73 ▼0.0143.11 ▼0.52
Dashboard /wp-admin2,288 ▲1035.86 ▲0.0399.78 ▼4.2238.62 ▼0.32
Posts /wp-admin/edit.php2,172 ▲832.03 ▲0.0235.75 ▼1.5333.51 ▼5.02
Add New Post /wp-admin/post-new.php1,593 ▲7424.12 ▲1.05728.25 ▲127.3238.55 ▼3.44
Media Library /wp-admin/upload.php1,484 ▲964.32 ▲0.06103.00 ▲0.5446.28 ▲2.06
Text Content /wp-admin/admin.php?page=text_content_options1,1531.8430.1130.73
Connection /wp-admin/admin.php?page=connection_options1,0411.8430.3745.16
DiscourseConnect /wp-admin/admin.php?page=sso_options9712.0630.3031.79
Publishing /wp-admin/admin.php?page=publishing_options1,2842.0735.0730.75
All Options /wp-admin/admin.php?page=wp_discourse_options1,0381.9130.2633.17
Webhooks /wp-admin/admin.php?page=webhook_options1,0371.9330.6932.00
Logs /wp-admin/admin.php?page=log_viewer9471.8329.3327.38
Commenting /wp-admin/admin.php?page=commenting_options1,2081.9530.8431.77

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/wp-discourse/tests/phpunit/bootstrap.php
  • 68× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WPDiscourse\\Monolog\\Handler\ullHandler' not found in wp-content/plugins/wp-discourse/lib/logs/handlers/null-handler.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'WPDiscourse\\Test\\UnitTest' not found in wp-content/plugins/wp-discourse/tests/phpunit/test-discourse-comment-formatter.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-discourse/blocks/comments/comments.php:55
    • > PHP Fatal error
      Uncaught Error: Class 'WPDiscourse\\Test\\UnitTest' not found in wp-content/plugins/wp-discourse/tests/phpunit/test-discourse-sso.php:16
    • > PHP Warning
      require_once(WPDISCOURSE_PATH/vendor_namespaced/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php): failed to open stream: No such file or directory in wp-content/plugins/wp-discourse/vendor_namespaced/autoload.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'Isolated\\Symfony\\Component\\Finder\\Finder' not found in wp-content/plugins/wp-discourse/scoper.inc.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'WPDiscourse\\Monolog\\Handler\\StreamHandler' not found in wp-content/plugins/wp-discourse/lib/logs/handlers/file-handler.php:16
    • > PHP Fatal error
      Trait 'WPDiscourse\\Shared\\PluginUtilities' not found in wp-content/plugins/wp-discourse/admin/network-options.php on line 17
    • > PHP Fatal error
      Uncaught Error: Class 'WPDiscourse\\DiscourseBase' not found in wp-content/plugins/wp-discourse/lib/discourse-publish.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'WPDiscourse\\SSOClient\\SSOClientBase' not found in wp-content/plugins/wp-discourse/lib/sso-client/client.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
4 plugin tags: comments, sso, discourse, forum

wp-discourse/wp-discourse.php 92% from 13 tests

The entry point to "WP Discourse" version 2.4.9 is a PHP file that has certain tags in its header comment area
The following require your attention:
  • Domain Path: The domain path points to a folder that does not exist ("/languages")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected80,788 lines of code in 137 files:
LanguageFilesBlank linesComment linesLines of code
JSON211064,909
PHP912,4275,96712,043
JavaScript93861182,790
CSS49410485
Markdown51450241
Bourne Shell12210129
XML33198
HTML20092
SVG1001

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity14.82
▷ Minimum class complexity1.00
▷ Maximum class complexity114.00
Average method complexity2.50
▷ Minimum method complexity1.00
▷ Maximum method complexity43.00
Code structure
Namespaces22
Interfaces5
Traits7
Classes68
▷ Abstract classes34.41%
▷ Concrete classes6595.59%
▷ Final classes00.00%
Methods752
▷ Static methods466.12%
▷ Public methods58377.53%
▷ Protected methods15220.21%
▷ Private methods172.26%
Functions31
▷ Named functions619.35%
▷ Anonymous functions2580.65%
Constants29
▷ Global constants724.14%
▷ Class constants2275.86%
▷ Public constants22100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
14 PNG files occupy 1.91MB with 1.12MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-5.png239.80KB63.75KB▼ 73.42%
assets/screenshot-3.png238.90KB63.78KB▼ 73.30%
blocks/comments/src/edit/avatars/b_240.png1.28KB1.37KB0.00%
assets/screenshot-7.png176.75KB44.93KB▼ 74.58%
assets/screenshot-2.png242.11KB67.50KB▼ 72.12%