68% presets

Code Review | Presets

WordPress plugin Presets scored68%from 54 tests.

About plugin

  • Plugin page: presets
  • Plugin version: 2.0.1
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.2
  • WordPress version: 6.3.1
  • First release: Apr 12, 2021
  • Latest release: May 16, 2023
  • Number of updates: 17
  • Update frequency: every 44.9 days
  • Top authors: felipeloureirosantos (88.24%)foosantos (17.65%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /976 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 gracefully, with no errors

Server metrics [RAM: ▲0.86MB] [CPU: ▲6.20ms] Passed 4 tests

Analyzing server-side resources used by Presets
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.00 ▲0.5438.13 ▼6.02
Dashboard /wp-admin4.32 ▲1.0157.32 ▲3.83
Posts /wp-admin/edit.php4.35 ▲0.9962.62 ▲14.26
Add New Post /wp-admin/post-new.php6.86 ▲0.97109.53 ▲17.59
Media Library /wp-admin/upload.php4.18 ▲0.9647.34 ▲12.74
All Presets /wp-admin/edit.php?post_type=presets4.2347.21
Tags /wp-admin/edit-tags.php?taxonomy=presets_tags&post_type=presets4.1845.18
Add New /wp-admin/post-new.php?post_type=presets4.7662.33

Server storage [IO: ▲8.50MB] [DB: ▲0.05MB] Passed 3 tests

Filesystem and database footprint
The plugin installed successfully
Filesystem: 1,979 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Presets
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,858 ▲11214.45 ▲0.042.03 ▲0.2939.49 ▼7.23
Dashboard /wp-admin2,258 ▲704.93 ▼0.97109.62 ▲5.5442.37 ▼2.02
Posts /wp-admin/edit.php2,141 ▲522.10 ▲0.1040.76 ▲5.2735.88 ▼1.36
Add New Post /wp-admin/post-new.php1,565 ▲5118.52 ▲1.04609.26 ▼72.6854.44 ▼1.25
Media Library /wp-admin/upload.php1,437 ▲494.29 ▼0.03103.84 ▼6.2741.41 ▼8.22
All Presets /wp-admin/edit.php?post_type=presets1,1102.0035.5529.39
Tags /wp-admin/edit-tags.php?taxonomy=presets_tags&post_type=presets1,2852.3029.5928.11
Add New /wp-admin/post-new.php?post_type=presets3,1817.42163.6671.08

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however 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
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/presets/vendor/cmb2/cmb2/apigen/hook-docs.php
  • 641× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Tests\\Standards\\AbstractSniffUnitTest' not found in wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ControlStructureSpacingUnitTest.php:14
    • > PHP Warning
      file_put_contents(/Users/JT/Sites/wpengine/api/hook-docs.html): failed to open stream: No such file or directory in wp-content/plugins/presets/vendor/cmb2/cmb2/apigen/hook-docs.php on line 229
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Tests\\Standards\\AbstractSniffUnitTest' not found in wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Tests/Classes/OpeningBraceSpaceUnitTest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Tests\\Standards\\AbstractSniffUnitTest' not found in wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/PHP/CommentedOutCodeUnitTest.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer\\Sniffs\\Sniff' not found in wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer\\Sniffs\\Sniff' not found in wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/src/Standards/PSR12/Sniffs/Functions/NullableTypeDeclarationSniff.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Tests\\Core\\AbstractMethodUnitTest' not found in wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizer/BackfillNumericSeparatorTest.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer\\Sniffs\\Sniff' not found in wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneClassPerFileSniff.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeSniffer\\Tests\\Standards\\AbstractSniffUnitTest' not found in wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/ControlStructures/SwitchDeclarationUnitTest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/presets/vendor/cmb2/cmb2/includes/types/CMB2_Type_Oembed.php:13

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)
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
2 plugin tags: tests, debug

presets/presets.php 92% from 13 tests

The main file in "Presets" v. 2.0.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Git Repository: Please do not include Git repositories in your plugin

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Almost there! Just fix the following issues
  • For security reasons, never distribute binary or executable files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/bin/phpcbf.bat
      • wp-content/plugins/presets/vendor/squizlabs/php_codesniffer/bin/phpcs.bat
148,972 lines of code in 1,414 files:
LanguageFilesBlank linesComment linesLines of code
PHP83921,05734,67480,343
PO File12014,31518,50232,323
XML1452092928,949
JSON12006,923
Pascal1303,2177,0906,548
CSS485541,2985,699
JavaScript771,3381,7015,006
Sass17306291,411
Markdown1437501,182
Bourne Shell46745209
YAML3166205
XSD160130
diff216834
DOS Batch241010

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
Please fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 478)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity15.53
▷ Minimum class complexity1.00
▷ Maximum class complexity721.00
Average method complexity4.81
▷ Minimum method complexity1.00
▷ Maximum method complexity478.00
Code structure
Namespaces160
Interfaces2
Traits0
Classes703
▷ Abstract classes233.27%
▷ Concrete classes68096.73%
▷ Final classes10.15%
Methods2,702
▷ Static methods1987.33%
▷ Public methods2,35987.31%
▷ Protected methods29310.84%
▷ Private methods501.85%
Functions51
▷ Named functions4078.43%
▷ Anonymous functions1121.57%
Constants129
▷ Global constants12093.02%
▷ Class constants96.98%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
22 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/cmb2/cmb2/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
vendor/cmb2/cmb2/images/ui-icons_888888_256x240.png5.23KB4.11KB▼ 21.49%
vendor/cmb2/cmb2/images/ui-bg_glass_55_fbf9ee_1x400.png0.12KB0.14KB0.00%
vendor/cmb2/cmb2/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
vendor/cmb2/cmb2/apigen/theme-bootstrap/src/resources/resize.png0.12KB0.10KB▼ 13.22%