84% smart-custom-fields

Code Review | Smart Custom Fields

WordPress plugin Smart Custom Fields scored84%from 54 tests.

About plugin

  • Plugin page: smart-custom-fields
  • Plugin version: 4.2.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.9-5.8
  • WordPress version: 6.3.1
  • First release: Oct 9, 2014
  • Latest release: Nov 18, 2021
  • Number of updates: 119
  • Update frequency: every 21.9 days
  • Top authors: inc2734 (98.32%)Mirucon (2.52%)

Code review

54 tests

User reviews

18 reviews

Install metrics

50,000+ active /211,946 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
Install script ran successfully

Server metrics [RAM: ▲0.76MB] [CPU: ▲0.16ms] Passed 4 tests

This is a short check of server-side resources used by Smart Custom Fields
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.19 ▲0.7350.34 ▲9.89
Dashboard /wp-admin4.10 ▲0.7555.13 ▼8.16
Posts /wp-admin/edit.php4.17 ▲0.8262.54 ▲13.58
Add New Post /wp-admin/post-new.php6.67 ▲0.7888.78 ▼10.33
Media Library /wp-admin/upload.php3.99 ▲0.7743.67 ▲9.26
Smart Custom Fields /wp-admin/edit.php?post_type=smart-custom-fields4.0649.31
Add New /wp-admin/post-new.php?post_type=smart-custom-fields4.1753.55

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Smart Custom Fields
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,205 ▲44419.69 ▲5.102.70 ▲1.0542.27 ▼1.55
Dashboard /wp-admin2,623 ▲4439.82 ▲4.14217.25 ▲130.5048.18 ▲9.98
Posts /wp-admin/edit.php2,705 ▲6086.87 ▲4.87154.72 ▲120.1340.26 ▲1.98
Add New Post /wp-admin/post-new.php6,641 ▲5,11327.05 ▲4.091,002.07 ▲312.1042.47 ▼13.82
Media Library /wp-admin/upload.php1,909 ▲5097.91 ▲3.78173.54 ▲69.8647.05 ▼1.75
Smart Custom Fields /wp-admin/edit.php?post_type=smart-custom-fields1,6726.78127.7231.26
Add New /wp-admin/post-new.php?post_type=smart-custom-fields4,0128.20159.5739.90

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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
  • 20× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Smart_Custom_Fields_Field_Base' not found in wp-content/plugins/smart-custom-fields/classes/fields/class.field-file.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Smart_Custom_Fields_Field_Base' not found in wp-content/plugins/smart-custom-fields/classes/fields/class.field-datetime-picker.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/smart-custom-fields/smart-custom-fields.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'Smart_Custom_Fields_Field_Base' not found in wp-content/plugins/smart-custom-fields/classes/fields/class.field-boolean.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Smart_Custom_Fields_Field_Base' not found in wp-content/plugins/smart-custom-fields/classes/fields/class.field-wysiwyg.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Smart_Custom_Fields_Field_Base' not found in wp-content/plugins/smart-custom-fields/classes/fields/class.field-image.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Smart_Custom_Fields_Controller_Base' not found in wp-content/plugins/smart-custom-fields/classes/controller/class.option.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Smart_Custom_Fields_Field_Base' not found in wp-content/plugins/smart-custom-fields/classes/fields/class.field-check.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Smart_Custom_Fields_Field_Base' not found in wp-content/plugins/smart-custom-fields/classes/fields/class.field-datepicker.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Smart_Custom_Fields_Field_Base' not found in wp-content/plugins/smart-custom-fields/classes/fields/class.field-radio.php:11

User-side errors Passed 1 test

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

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 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
8 plugin tags: meta, repeatable, repeat, meta field, custom...

smart-custom-fields/smart-custom-fields.php Passed 13 tests

The entry point to "Smart Custom Fields" version 4.2.2 is a PHP file that has certain tags in its header comment area
69 characters long description:
Smart Custom Fields is a simple plugin that management custom fields.

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 plugin10,756 lines of code in 77 files:
LanguageFilesBlank linesComment linesLines of code
PHP446482,3135,124
JavaScript167171,6394,320
CSS1071209633
PO File2156272350
Markdown31190291
JSON20038

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity16.13
▷ Minimum class complexity1.00
▷ Maximum class complexity105.00
Average method complexity3.02
▷ Minimum method complexity1.00
▷ Maximum method complexity22.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes38
▷ Abstract classes12.63%
▷ Concrete classes3797.37%
▷ Final classes00.00%
Methods290
▷ Static methods5117.59%
▷ Public methods21774.83%
▷ Protected methods6622.76%
▷ Private methods72.41%
Functions3
▷ Named functions133.33%
▷ Anonymous functions266.67%
Constants3
▷ Global constants00.00%
▷ Class constants3100.00%
▷ Public constants3100.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
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
images/handle.png0.20KB0.10KB▼ 48.28%