74% code-snippets

Code Review | Code Snippets

WordPress plugin Code Snippets scored74%from 54 tests.

About plugin

  • Plugin page: code-snippets
  • Plugin version: 3.6.2
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.4
  • WordPress version: 6.3.1
  • First release: Jun 13, 2012
  • Latest release: Nov 11, 2023
  • Number of updates: 297
  • Update frequency: every 14.0 days
  • Top authors: bungeshea (100%)

Code review

54 tests

User reviews

425 reviews

Install metrics

800,000+ active /9,175,852 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.91MB] [CPU: ▲6.48ms] Passed 4 tests

An overview of server-side resources used by Code Snippets
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.12 ▲0.6545.65 ▲8.88
Dashboard /wp-admin4.28 ▲0.9858.50 ▲13.31
Posts /wp-admin/edit.php4.40 ▲1.0452.33 ▲5.78
Add New Post /wp-admin/post-new.php6.96 ▲1.07100.67 ▲3.67
Media Library /wp-admin/upload.php4.21 ▲0.9840.23 ▲7.57
Add New /wp-admin/admin.php?page=add-snippet4.3943.15
Import /wp-admin/admin.php?page=import-code-snippets4.2138.90
Settings /wp-admin/admin.php?page=snippets-settings4.2439.93
All Snippets /wp-admin/admin.php?page=snippets4.6750.98
Go Pro /wp-admin/admin.php?page=code_snippets_upgrade4.0133.42

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 321 new files
Database: 1 new table, 9 new options
New tables
wp_snippets
New WordPress options
recently_activated_snippets
theysaidso_admin_options
widget_recent-comments
code_snippets_version
widget_recent-posts
db_upgraded
can_compress_scripts
code_snippets_settings
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Code Snippets
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,843 ▲5614.68 ▲0.611.77 ▼0.5732.61 ▼12.47
Dashboard /wp-admin2,252 ▲785.62 ▼0.0385.03 ▼9.5037.12 ▼5.21
Posts /wp-admin/edit.php2,156 ▲591.96 ▼0.0638.29 ▲2.5434.52 ▼1.98
Add New Post /wp-admin/post-new.php1,572 ▲3618.50 ▼4.54608.35 ▼70.2366.08 ▲6.65
Media Library /wp-admin/upload.php1,456 ▲594.17 ▼0.0297.56 ▼3.1442.71 ▼0.75
Add New /wp-admin/admin.php?page=add-snippet1,78613.27394.5396.60
Import /wp-admin/admin.php?page=import-code-snippets9942.0223.2832.14
Settings /wp-admin/admin.php?page=snippets-settings1,6594.5694.5929.21
All Snippets /wp-admin/admin.php?page=snippets1,7232.0537.2141.98
Go Pro /wp-admin/admin.php?page=code_snippets_upgrade6,75417.71364.81192.51

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Zombie tables detected upon uninstall: 1 table
    • wp_snippets
  • This plugin does not fully uninstall, leaving 9 options in the database
    • widget_theysaidso_widget
    • code_snippets_settings
    • widget_recent-posts
    • widget_recent-comments
    • code_snippets_version
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • recently_activated_snippets

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 125× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/PantheonInstaller.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/code-snippets/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php:4

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed:
  • License uri: Please fix this invalid url: "license.txt"
You can look at the official readme.txt

code-snippets/code-snippets.php Passed 13 tests

The main PHP script in "Code Snippets" version 3.6.2 is automatically included on every request by WordPress
122 characters long description:
An easy, clean and simple way to run code snippets on your site. No need to edit to your theme's functions.php file again!

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
Success! There were no dangerous files found in this plugin12,580 lines of code in 313 files:
LanguageFilesBlank linesComment linesLines of code
PHP1562,0523,8378,339
TypeScript61392742,551
Sass1426701,235
JSON200282
SVG20097
CSS729072
JavaScript6054

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity7.23
▷ Minimum class complexity1.00
▷ Maximum class complexity163.00
Average method complexity2.99
▷ Minimum method complexity1.00
▷ Maximum method complexity36.00
Code structure
Namespaces8
Interfaces0
Traits0
Classes132
▷ Abstract classes32.27%
▷ Concrete classes12997.73%
▷ Final classes10.78%
Methods414
▷ Static methods4510.87%
▷ Public methods28268.12%
▷ Protected methods8119.57%
▷ Private methods5112.32%
Functions67
▷ Named functions4770.15%
▷ Anonymous functions2029.85%
Constants34
▷ Global constants38.82%
▷ Class constants3191.18%
▷ Public constants31100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
PNG images were not found in this plugin