83% cmb2

Code Review | CMB2

WordPress plugin CMB2 scored83%from 54 tests.

About plugin

  • Plugin page: cmb2
  • Plugin version: 2.10.1
  • PHP compatiblity: 5.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8.0-5.9
  • WordPress version: 6.3.1
  • First release: Sep 16, 2014
  • Latest release: Feb 22, 2022
  • Number of updates: 97
  • Update frequency: every 31.7 days
  • Top authors: jtsternberg (95.88%)tw2113 (5.15%)

Code review

54 tests

User reviews

86 reviews

Install metrics

300,000+ active /3,970,044 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.28MB] [CPU: ▼4.09ms] Passed 4 tests

Analyzing server-side resources used by CMB2
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.72 ▲0.2650.71 ▲4.69
Dashboard /wp-admin3.63 ▲0.3251.60 ▼4.99
Posts /wp-admin/edit.php3.68 ▲0.3256.39 ▲3.62
Add New Post /wp-admin/post-new.php6.15 ▲0.2691.08 ▼15.50
Media Library /wp-admin/upload.php3.49 ▲0.2641.18 ▲0.50

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 339 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-posts
db_upgraded
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

CMB2: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.34 ▼0.311.83 ▼0.1539.89 ▼3.79
Dashboard /wp-admin2,195 ▲215.62 ▲0.1094.58 ▲0.3141.97 ▲0.13
Posts /wp-admin/edit.php2,097 ▼32.00 ▼0.0239.52 ▼2.2836.35 ▼5.84
Add New Post /wp-admin/post-new.php1,526 ▼023.56 ▲0.42663.10 ▼29.2268.38 ▲12.52
Media Library /wp-admin/upload.php1,400 ▼04.20 ▼0.0299.74 ▼10.0443.68 ▼4.43

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts

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
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 39× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Picker_Base' not found in wp-content/plugins/cmb2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Select' not found in wp-content/plugins/cmb2/includes/types/CMB2_Type_Taxonomy_Select_Hierarchical.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Multicheck' not found in wp-content/plugins/cmb2/includes/types/CMB2_Type_Taxonomy_Multicheck_Hierarchical.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Base' not found in wp-content/plugins/cmb2/includes/types/CMB2_Type_Taxonomy_Radio.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Base' not found in wp-content/plugins/cmb2/includes/CMB2_Field.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/cmb2/includes/types/CMB2_Type_Oembed.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/cmb2/includes/types/CMB2_Type_Title.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Hookup_Base' not found in wp-content/plugins/cmb2/includes/CMB2_Hookup.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_REST_Controller' not found in wp-content/plugins/cmb2/includes/rest-api/CMB2_REST_Controller_Boxes.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/cmb2/includes/types/CMB2_Type_Counter_Base.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: forms, metaboxes, options, settings, fields

cmb2/init.php 77% from 13 tests

"CMB2" version 2.10.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Domain Path: Prefix the domain path with a forward slash character ("/languages")
  • Domain Path: Note that the domain path follows the same naming rules as the domain name, using only dashes and lowercase characters ("languages")
  • Main file name: Name the main plugin file the same as the plugin slug ("cmb2.php" instead of "init.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin46,369 lines of code in 198 files:
LanguageFilesBlank linesComment linesLines of code
PO File12014,31518,50232,323
PHP562,1776,3877,293
CSS122501,1904,554
JavaScript73615831,431
Markdown32490768

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity19.31
▷ Minimum class complexity1.00
▷ Maximum class complexity188.00
Average method complexity3.31
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes68
▷ Abstract classes913.24%
▷ Concrete classes5986.76%
▷ Final classes00.00%
Methods542
▷ Static methods9116.79%
▷ Public methods45083.03%
▷ Protected methods8916.42%
▷ Private methods30.55%
Functions34
▷ Named functions34100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants333.33%
▷ Class constants666.67%
▷ Public constants6100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
14 PNG files occupy 0.02MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/ico-delete.png0.70KB0.72KB0.00%
images/ui-icons_888888_256x240.png5.23KB4.11KB▼ 21.49%
images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%
images/ui-bg_glass_55_fbf9ee_1x400.png0.12KB0.14KB0.00%