84% knowledge-base-cpt

Code Review | Knowledge Base CPT

WordPress plugin Knowledge Base CPT scored 84% from 54 tests.

About plugin

  • Plugin page: knowledge-base-cpt
  • Plugin version: 1.1.1
  • PHP compatiblity: 5.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.3
  • WordPress version: 6.3.1
  • First release: Jan 18, 2015
  • Latest release: Nov 14, 2019
  • Number of updates: 28
  • Update frequency: every 62.9 days
  • Top authors: DannyCooper (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

90+ active / 7,268 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼3.19ms] Passed 4 tests

Analyzing server-side resources used by Knowledge Base CPT
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0843.27 ▲0.88
Dashboard /wp-admin3.36 ▲0.0648.70 ▼0.48
Posts /wp-admin/edit.php3.48 ▲0.1245.39 ▼2.19
Add New Post /wp-admin/post-new.php5.94 ▲0.0685.78 ▼10.96
Media Library /wp-admin/upload.php3.29 ▲0.0638.34 ▲5.44
All Articles /wp-admin/edit.php?post_type=knowledge_base3.3336.38
Add New /wp-admin/post-new.php?post_type=knowledge_base3.5053.52
Sections /wp-admin/edit-tags.php?taxonomy=section&post_type=knowledge_base3.4336.37

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 9 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
widget_ot_knowledge_articles_widget
db_upgraded
theysaidso_admin_options
ot_knowledge_version

Browser metrics Passed 4 tests

An overview of browser requirements for Knowledge Base CPT
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,834 ▲9913.34 ▼1.041.90 ▲0.1741.77 ▲1.01
Dashboard /wp-admin2,237 ▲495.81 ▼0.2298.85 ▲1.6838.41 ▼5.13
Posts /wp-admin/edit.php2,120 ▲312.02 ▲0.0136.16 ▼1.8032.63 ▼1.02
Add New Post /wp-admin/post-new.php1,540 ▲2617.63 ▲0.12656.74 ▲33.9154.11 ▲3.46
Media Library /wp-admin/upload.php1,419 ▲314.22 ▼0.0198.62 ▼5.4444.05 ▲0.77
All Articles /wp-admin/edit.php?post_type=knowledge_base1,1401.9330.0828.76
Add New /wp-admin/post-new.php?post_type=knowledge_base2,6467.81172.5266.85
Sections /wp-admin/edit-tags.php?taxonomy=section&post_type=knowledge_base1,2902.1427.3928.46

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 were found after uninstall: 8 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • ot_knowledge_version
    • widget_ot_knowledge_articles_widget
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 6× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/knowledge-base-cpt/includes/register-settings.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/knowledge-base-cpt/knowledge-base-CPT.php:42
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/knowledge-base-cpt/includes/register-recent-widget.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/knowledge-base-cpt/includes/register-cpt.php:58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/knowledge-base-cpt/includes/register-taxonomy.php:47
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/knowledge-base-cpt/includes/register-shortcode.php:98

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 Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
5 plugin tags: faqs, documentation, wiki, knowledge base, custom post type

knowledge-base-cpt/knowledge-base-CPT.php 85% from 13 tests

"Knowledge Base CPT" version 1.1.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Main file name: The principal plugin file should be the same as the plugin slug ("knowledge-base-cpt.php" instead of "knowledge-base-CPT.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected393 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP693142299
PO File1353594

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.23
Average class complexity8.33
▷ Minimum class complexity2.00
▷ Maximum class complexity17.00
Average method complexity2.57
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods14
▷ Static methods17.14%
▷ Public methods14100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There are no PNG files in this plugin