74% code-snippets

Code Review | Code Snippets

WordPress plugin Code Snippets scored 74% from 53 tests.

About plugin

  • Plugin page: code-snippets
  • Plugin version: 2.14.2
  • PHP compatiblity: 5.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-5.8.1
  • WordPress version: 5.8.1
  • First release: Jun 13, 2012
  • Latest release: Sep 14, 2021
  • Number of updates: 244
  • Update frequency: every 13.9 days
  • Top authors: bungeshea (100%)

Code review

53 tests

User reviews

321 reviews

Install metrics

500,000+ active / 2,769,440 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.44MB] [CPU: ▼291.43ms] Passed 4 tests

This is a short check of server-side resources used by Code Snippets
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.08 ▲0.2439.44 ▲7.40
Dashboard /wp-admin3.61 ▲0.5645.62 ▼1.52
Posts /wp-admin/edit.php3.66 ▲0.5547.25 ▲0.07
Add New Post /wp-admin/post-new.php5.91 ▲0.4893.68 ▼1,152.27
Media Library /wp-admin/upload.php3.49 ▲0.4829.18 ▼11.98
Add New /wp-admin/admin.php?page=add-snippet3.6437.34
Settings /wp-admin/admin.php?page=snippets-settings3.5536.26
Import /wp-admin/admin.php?page=import-code-snippets3.4934.44
All Snippets /wp-admin/admin.php?page=snippets3.7542.61

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 145 new files
Database: 1 new table, 3 new options
New tables
wp_snippets
New WordPress options
code_snippets_settings
recently_activated_snippets
code_snippets_version

Browser metrics Passed 4 tests

Checking browser requirements for Code Snippets
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,742 ▲16016.27 ▲0.428.16 ▲0.9945.81 ▼1.83
Dashboard /wp-admin3,003 ▲1535.98 ▲0.12137.01 ▲8.15113.59 ▲13.44
Posts /wp-admin/edit.php2,747 ▲412.70 ▼0.0064.79 ▼0.7291.22 ▲6.50
Add New Post /wp-admin/post-new.php1,680 ▲2718.79 ▼0.03355.46 ▼3.58109.42 ▼4.29
Media Library /wp-admin/upload.php1,813 ▲385.02 ▲0.02140.37 ▼15.48115.99 ▼7.36
Add New /wp-admin/admin.php?page=add-snippet2,2677.43167.63165.36
Settings /wp-admin/admin.php?page=snippets-settings1,9664.0995.2284.00
Import /wp-admin/admin.php?page=import-code-snippets1,2462.0960.8574.66
All Snippets /wp-admin/admin.php?page=snippets2,0742.3362.3272.07

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Zombie tables detected upon uninstall: 1 table
    • wp_snippets
  • This plugin does not fully uninstall, leaving 3 options in the database
    • code_snippets_version
    • recently_activated_snippets
    • code_snippets_settings

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 8× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Code_Snippets_Admin_Menu' not found in wp-content/plugins/code-snippets/php/admin-menus/class-settings-menu.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/code-snippets/php/settings/settings.php:158
    • > PHP Fatal error
      Uncaught Error: Class 'Code_Snippets_Admin_Menu' not found in wp-content/plugins/code-snippets/php/admin-menus/class-manage-menu.php:8
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/code-snippets/php/class-list-table.php on line 11
    • > PHP Fatal error
      Uncaught Error: Class 'Code_Snippets_Admin_Menu' not found in wp-content/plugins/code-snippets/php/admin-menus/class-edit-menu.php:6
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/code-snippets/php/class-list-table.php on line 11
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/code-snippets/php/class-list-table.php on line 11
    • > PHP Fatal error
      Uncaught Error: Class 'Code_Snippets_Admin_Menu' not found in wp-content/plugins/code-snippets/php/admin-menus/class-import-menu.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • License uri: Invalid url: ""
The official readme.txt is a good inspiration

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

"Code Snippets" version 2.14.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
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 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin12,240 lines of code in 123 files:
LanguageFilesBlank linesComment linesLines of code
PO File162,8323,5698,509
PHP271,2221,7923,639
CSS732073
SVG10011
JavaScript60198

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity32.71
▷ Minimum class complexity3.00
▷ Maximum class complexity154.00
Average method complexity3.71
▷ Minimum method complexity1.00
▷ Maximum method complexity37.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes14
▷ Abstract classes00.00%
▷ Concrete classes14100.00%
▷ Final classes00.00%
Methods164
▷ Static methods42.44%
▷ Public methods10865.85%
▷ Protected methods127.32%
▷ Private methods4426.83%
Functions43
▷ Named functions43100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants120.00%
▷ Class constants480.00%
▷ Public constants4100.00%

Plugin size Passed 1 test

Image compression Passed 1 test

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin