84% code-snippets-cpt

Code Review | Code Snippets CPT

WordPress plugin Code Snippets CPT scored84%from 54 tests.

About plugin

  • Plugin page: code-snippets-cpt
  • Plugin version: 2.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8.0-4.7.3
  • WordPress version: 6.3.1
  • First release: Dec 20, 2014
  • Latest release: Apr 5, 2017
  • Number of updates: 42
  • Update frequency: every 19.9 days
  • Top authors: jtsternberg (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

300+ active /8,352 total downloads

Benchmarks

Plugin footprint 83% 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.14MB] [CPU: ▲6.75ms] Passed 4 tests

A check of server-side resources used by Code Snippets CPT
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.1141.19 ▲4.45
Dashboard /wp-admin3.72 ▲0.4156.74 ▲11.99
Posts /wp-admin/edit.php3.46 ▲0.1048.72 ▲3.79
Add New Post /wp-admin/post-new.php6.14 ▲0.2595.39 ▲13.30
Media Library /wp-admin/upload.php3.33 ▲0.1041.99 ▲6.76
Settings /wp-admin/edit.php?post_type=code-snippets&page=code-snippets-cpt3.3232.45
All Code Snippets /wp-admin/edit.php?post_type=code-snippets3.3637.93
Snippet Tags /wp-admin/edit-tags.php?taxonomy=snippet-tags&post_type=code-snippets3.3235.54
Add New Code Snippet /wp-admin/post-new.php?post_type=code-snippets3.6749.72
Snippet Categories /wp-admin/edit-tags.php?taxonomy=snippet-categories&post_type=code-snippets3.3235.64

Server storage [IO: ▲18.26MB] [DB: ▲0.01MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 718 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
widget_recent-comments
languages_children
widget_theysaidso_widget
db_upgraded
dsgnwrks_snippet_version

Browser metrics Passed 4 tests

An overview of browser requirements for Code Snippets CPT
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,873 ▲1,10215.73 ▲1.352.58 ▲0.8443.08 ▲0.24
Dashboard /wp-admin3,261 ▲1,0736.16 ▲0.26131.69 ▲30.9489.74 ▲48.19
Posts /wp-admin/edit.php2,128 ▲392.03 ▲0.0336.90 ▲1.2936.09 ▲1.28
Add New Post /wp-admin/post-new.php2,667 ▲1,13919.12 ▲1.19700.44 ▲104.0240.14 ▼9.39
Media Library /wp-admin/upload.php1,427 ▲364.15 ▼0.0692.88 ▼6.9939.95 ▼3.41
Settings /wp-admin/edit.php?post_type=code-snippets&page=code-snippets-cpt8522.0326.8225.96
All Code Snippets /wp-admin/edit.php?post_type=code-snippets1,1331.9328.7729.75
Snippet Tags /wp-admin/edit-tags.php?taxonomy=snippet-tags&post_type=code-snippets1,2702.1326.5827.01
Add New Code Snippet /wp-admin/post-new.php?post_type=code-snippets2,5603.9578.9267.93
Snippet Categories /wp-admin/edit-tags.php?taxonomy=snippet-categories&post_type=code-snippets1,2982.1427.3525.73

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • db_upgraded
    • widget_recent-comments
    • dsgnwrks_snippet_version
    • can_compress_scripts
    • widget_theysaidso_widget
    • languages_children
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 75% 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 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/code-snippets-cpt/dsgnwrks-code-snippets-cpt.php:39
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/code-snippets-cpt/lib/views/settings-page.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'CodeSnippitInit' not found in wp-content/plugins/code-snippets-cpt/lib/views/snippet-window.php:43
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/code-snippets-cpt/lib/views/shortcode-button-form.php:70

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
No tags were found

code-snippets-cpt/dsgnwrks-code-snippets-cpt.php 92% from 13 tests

The primary PHP file in "Code Snippets CPT" version 2.1.0 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("code-snippets-cpt.php" instead of "dsgnwrks-code-snippets-cpt.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin245,674 lines of code in 707 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript68726,18116,803243,316
PHP102761701,466
CSS611359501
Sass4533391

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.37
Average class complexity27.50
▷ Minimum class complexity5.00
▷ Maximum class complexity45.00
Average method complexity3.37
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods67
▷ Static methods710.45%
▷ Public methods6698.51%
▷ Protected methods11.49%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants250.00%
▷ Class constants250.00%
▷ Public constants2100.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
3 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/css/code-snippets32.png2.11KB1.25KB▼ 40.53%
assets/js/icon.png1.50KB0.71KB▼ 52.99%
assets/css/code-snippets.png1.59KB1.04KB▼ 34.36%