83% dw-knowledge-base

Code Review | DW Knowledge Base

WordPress plugin DW Knowledge Base scored 83% from 54 tests.

About plugin

  • Plugin page: dw-knowledge-base
  • Plugin version: 1.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.5
  • WordPress version: 5.9.2
  • First release: Feb 29, 2016
  • Latest release: Nov 2, 2016
  • Number of updates: 13
  • Update frequency: every 19.2 days
  • Top authors: designwall (76.92%)khoipro (30.77%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active / 6,256 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.36MB] [CPU: ▼295.13ms] Passed 4 tests

Analyzing server-side resources used by DW Knowledge Base
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.85 ▲0.3460.24 ▲7.30
Dashboard /wp-admin3.79 ▲0.3938.29 ▲3.46
Posts /wp-admin/edit.php4.02 ▲0.3844.09 ▲3.26
Add New Post /wp-admin/post-new.php7.32 ▲0.3598.63 ▼1,186.04
Media Library /wp-admin/upload.php3.74 ▲0.4530.25 ▼1.18
Categories /wp-admin/edit-tags.php?taxonomy=dwkb_category&post_type=dwkb3.7430.57
Settings /wp-admin/edit.php?post_type=dwkb&page=dwkb_options4.1829.48
Tags /wp-admin/edit-tags.php?taxonomy=dwkb_tag&post_type=dwkb3.7427.92
All Articles /wp-admin/edit.php?post_type=dwkb3.7929.49
Add New /wp-admin/post-new.php?post_type=dwkb4.0555.74

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 316 new files
Database: no new tables, 1 new option
New WordPress options
dwkb_category_children

Browser metrics Passed 4 tests

A check of browser resources used by DW Knowledge Base
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,997 ▲23716.26 ▲0.5511.90 ▲6.172.69 ▲0.03
Dashboard /wp-admin2,944 ▲726.02 ▼0.19117.13 ▼20.25151.92 ▼14.01
Posts /wp-admin/edit.php2,740 ▲523.37 ▲0.1365.66 ▲2.47165.14 ▲20.61
Add New Post /wp-admin/post-new.php1,792 ▲4016.98 ▼4.85430.40 ▼20.05157.85 ▼2.54
Media Library /wp-admin/upload.php1,742 ▲505.56 ▲0.03142.59 ▲8.28187.76 ▲1.96
Categories /wp-admin/edit-tags.php?taxonomy=dwkb_category&post_type=dwkb1,8022.9255.85138.48
Settings /wp-admin/edit.php?post_type=dwkb&page=dwkb_options1,2742.6556.33120.68
Tags /wp-admin/edit-tags.php?taxonomy=dwkb_tag&post_type=dwkb1,6422.9154.30102.86
All Articles /wp-admin/edit.php?post_type=dwkb1,4753.3059.87113.28
Add New /wp-admin/post-new.php?post_type=dwkb3,52210.11201.35201.85

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 1 option in the database
    • dwkb_category_children

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

SRP 50% 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
Please fix the following items
  • 27× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_terms() in wp-content/plugins/dw-knowledge-base/templates/front/index-dwkb-default.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/dw-knowledge-base/inc/widgets/dwkb-category.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function have_posts() in wp-content/plugins/dw-knowledge-base/templates/front/single-dwkb.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/dw-knowledge-base/inc/cmb2/includes/types/cmb2_post_search_field.php:23
    • > PHP Warning
      require_once(DWKB_DIRinc/widgets/dwkb-article.php): failed to open stream: No such file or directory in wp-content/plugins/dw-knowledge-base/inc/widgets.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/dw-knowledge-base/inc/cmb2/example-functions.php:68
    • > PHP Warning
      Use of undefined constant DWKB_DIR - assumed 'DWKB_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/dw-knowledge-base/templates/admin/settings.php on line 2
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/dw-knowledge-base/inc/cmb2-taxonomy/includes/CMB2_Taxonomy.php on line 15
    • > PHP Warning
      Use of undefined constant DWKB_DIR - assumed 'DWKB_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/dw-knowledge-base/templates/admin/settings.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/dw-knowledge-base/inc/cmb2/bootstrap.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #1 (DW Knowledge Base - Article List), #2 (DW Knowledge Base - Plugin Setting), #3 (DW Knowledge Base - Front-End Index), #4 (DW Knowledge Base - Single Article)
  • Tags: Please delete some tags, you are using 12 tag instead of maximum 10
The official readme.txt is a good inspiration

dw-knowledge-base/dw-knowledgebase.php 85% from 13 tests

Analyzing the main PHP file in "DW Knowledge Base" version 1.0.2
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("dw-knowledge-base.php" instead of "dw-knowledgebase.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin38,902 lines of code in 163 files:
LanguageFilesBlank linesComment linesLines of code
PO File11912,73116,32929,151
PHP321,1902,3244,718
CSS51,0391,0233,970
JavaScript4165116698
Markdown31310365

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity33.11
▷ Minimum class complexity1.00
▷ Maximum class complexity121.00
Average method complexity3.63
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes18
▷ Abstract classes00.00%
▷ Concrete classes18100.00%
▷ Final classes00.00%
Methods220
▷ Static methods209.09%
▷ Public methods20995.00%
▷ Protected methods83.64%
▷ Private methods31.36%
Functions66
▷ Named functions66100.00%
▷ Anonymous functions00.00%
Constants25
▷ Global constants2392.00%
▷ Class constants28.00%
▷ Public constants2100.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
21 PNG files occupy 0.59MB with 0.22MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/cmb2/includes/types/post-search-dialog.png74.57KB23.25KB▼ 68.82%
inc/cmb2/images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%
inc/cmb2/images/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%
screenshot-1.png110.60KB35.70KB▼ 67.72%
inc/cmb2/images/ico-delete.png0.70KB0.72KB0.00%