10% wp-code-snippet

Code Review | WP Code Snippet

WordPress plugin WP Code Snippet scored10%from 54 tests.

About plugin

  • Plugin page: wp-code-snippet
  • Plugin version: 1.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.4.2
  • WordPress version: 6.3.1
  • First release: Jun 28, 2020
  • Latest release: Jun 28, 2020
  • Number of updates: 2
  • Update frequency: every 1.0 days
  • Top authors: ikamal (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /410 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Please fix the following installer errors
  • Install procedure had errors
    • > Error in wp-content/plugins/wp-code-snippet/wp-code-snippet.php+27
    Uncaught Error: Class 'Kamal\CodeSnippet\Blocks\Code_block' not found in wp-content/plugins/wp-code-snippet/wp-code-snippet.php:27
    Stack trace:
    #0 wp-content/plugins/wp-code-snippet/wp-code-snippet.php(45): Code_Snippet->__construct()
    #1 wp-content/plugins/wp-code-snippet/wp-code-snippet.php(69): Code_Snippet::init()
    #2 wp-content/plugins/wp-code-snippet/wp-code-snippet.php(72): codeSnippet_init()
    #3 wp-admin/includes/plugin.php(2318): include_once('/var/www/wordpr...')
    #4 wp-admin/includes/plugin.php(663): plugin_sandbox_scrape()

Server metrics [RAM: ▼0.01MB] [CPU: ▼6.79ms] Passed 4 tests

An overview of server-side resources used by WP Code Snippet
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0035.79 ▼1.00
Dashboard /wp-admin3.31 ▼0.0444.33 ▼11.70
Posts /wp-admin/edit.php3.36 ▲0.0048.30 ▼1.68
Add New Post /wp-admin/post-new.php5.89 ▲0.0090.23 ▼12.76
Media Library /wp-admin/upload.php3.23 ▲0.0036.21 ▲1.59

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 449 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
db_upgraded
widget_recent-posts
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

WP Code Snippet: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7913.23 ▼1.161.89 ▲0.3141.98 ▼1.06
Dashboard /wp-admin2,203 ▲124.85 ▼1.01113.20 ▲10.0439.03 ▼3.29
Posts /wp-admin/edit.php2,089 ▼32.05 ▲0.0040.11 ▼1.9633.77 ▼2.79
Add New Post /wp-admin/post-new.php1,542 ▲2818.33 ▲0.73587.33 ▼60.0353.32 ▼6.35
Media Library /wp-admin/upload.php1,388 ▲34.27 ▲0.1094.84 ▼20.0641.34 ▼7.88

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts

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 no errors were found, this is by no means an exhaustive test

SRP 0% 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
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/templates/Exception/incorrect-syntax.php
  • 112× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Service\\Service' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Service/REST_API_Service.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Condition\\Term_Condition' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Container/Condition/Post_Term_Condition.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Fulfillable\\Translator\\Array_Translator' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Container/Fulfillable/Translator/Json_Translator.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Container' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Container/Widget_Container.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Field\\Field' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Field/Html_Field.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Field\\Field' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Field/File_Field.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Datastore\\Key_Value_Datastore' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Datastore/Theme_Options_Datastore.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Condition\\User_Role_Condition' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Container/Condition/Current_User_Role_Condition.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Condition\\Comparer\\Comparer' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Container/Condition/Comparer/Any_Contain_Comparer.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon_Fields\\Container\\Condition\\Term_Condition' not found in wp-content/plugins/wp-code-snippet/vendor/htmlburger/carbon-fields/core/Container/Condition/Term_Ancestor_Condition.php:28

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that need to be fixed:
  • Screenshots: Please add images for these screenshots: #1 (Classic editor shortcode), #2 (Gutenburg block), #3 (Frontend Preview)
The official readme.txt is a good inspiration

wp-code-snippet/wp-code-snippet.php 85% from 13 tests

"WP Code Snippet" version 1.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Domain Path: The domain path folder was not found ("/languages/")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

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
Good job! No executable or dangerous file extensions detected27,361 lines of code in 402 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript1725,1788,44512,918
PHP1462,4616,5038,681
CSS83661,1641,902
Sass4833401,746
PO File206107791,652
JSON400368
Markdown435094

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity8.06
▷ Minimum class complexity1.00
▷ Maximum class complexity50.00
Average method complexity2.03
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces24
Interfaces5
Traits0
Classes124
▷ Abstract classes118.87%
▷ Concrete classes11391.13%
▷ Final classes10.88%
Methods899
▷ Static methods9110.12%
▷ Public methods73081.20%
▷ Protected methods16518.35%
▷ Private methods40.44%
Functions103
▷ Named functions2221.36%
▷ Anonymous functions8178.64%
Constants33
▷ Global constants1030.30%
▷ Class constants2369.70%
▷ Public constants23100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
3 PNG files occupy 0.54MB with 0.44MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png134.68KB21.46KB▼ 84.07%
screenshot-3.png260.51KB50.71KB▼ 80.53%
screenshot-1.png152.91KB26.25KB▼ 82.84%