68% rest-cache

Code Review | REST Cache

WordPress plugin REST Cache scored68%from 54 tests.

About plugin

  • Plugin page: rest-cache
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4.0-5.5.1
  • WordPress version: 6.3.1
  • First release: Sep 11, 2020
  • Latest release: Sep 11, 2020
  • Number of updates: 2
  • Update frequency: every 1.0 days
  • Top authors: perryrylance (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /397 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.00MB] [CPU: ▼5.97ms] Passed 4 tests

A check of server-side resources used by REST Cache
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0041.10 ▼3.71
Dashboard /wp-admin3.31 ▲0.0051.54 ▼3.59
Posts /wp-admin/edit.php3.36 ▲0.0047.28 ▼2.67
Add New Post /wp-admin/post-new.php5.89 ▲0.0088.39 ▼10.11
Media Library /wp-admin/upload.php3.23 ▲0.0031.24 ▼6.48

Server storage [IO: ▲4.38MB] [DB: ▲0.00MB] 67% from 3 tests

Input-output and database impact of this plugin
Please try to fix the following items
  • There were 1 file (0.84KB) illegally modified outside of "wp-content/plugins/rest-cache/" and "wp-content/uploads/"
    • (modified) .htaccess
Filesystem: 190 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
rest-cache-version
can_compress_scripts
db_upgraded
rest-cache-first-run

Browser metrics Passed 4 tests

REST Cache: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.19 ▼0.392.32 ▲0.4951.21 ▲6.45
Dashboard /wp-admin2,195 ▲185.65 ▲0.0295.29 ▼14.8143.68 ▼10.44
Posts /wp-admin/edit.php2,103 ▼02.00 ▼0.0338.07 ▼6.8833.47 ▼4.79
Add New Post /wp-admin/post-new.php1,544 ▲423.32 ▲0.17644.07 ▲8.6255.00 ▼14.49
Media Library /wp-admin/upload.php1,397 ▼34.29 ▲0.07101.12 ▼2.2345.76 ▼2.48

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The uninstall procedure has failed, leaving 8 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • rest-cache-version
    • widget_recent-posts
    • theysaidso_admin_options
    • rest-cache-first-run
    • db_upgraded
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
  • 45× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php
    • > /wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/button.blade.php
    • > /wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php
    • > /wp-content/plugins/rest-cache/service/resources/views/pages/admin.blade.php
    • > /wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/layout.blade.php
    • > /wp-content/plugins/rest-cache/service/vendor/hautelook/phpass/Tests/bootstrap.php
    • > /wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php
    • > /wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/table.blade.php
    • > /wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/header.blade.php
    • > /wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/layout.blade.php
  • 2445× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Corcel\\Tests\\TestCase' not found in wp-content/plugins/rest-cache/service/vendor/jgrossi/corcel/tests/Unit/Model/MenuTest.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Egulias\\EmailValidator\\Exception\\InvalidEmail' not found in wp-content/plugins/rest-cache/service/vendor/egulias/email-validator/src/Exception/NoLocalPart.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Thunder\\Shortcode\\Tests\\AbstractTestCase' not found in wp-content/plugins/rest-cache/service/vendor/thunderer/shortcode/tests/ShortcodeTest.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Mime\\Header\\AbstractHeader' not found in wp-content/plugins/rest-cache/service/vendor/symfony/mime/Header/IdentificationHeader.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Illuminate\\Database\\Migrations\\Migration' not found in wp-content/plugins/rest-cache/service/vendor/jgrossi/corcel/tests/database/migrations/2017_07_05_181600_create_corcel_term_taxonomy_table.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Illuminate\\Queue\\Failed\\FailedJobProviderInterface' not found in wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Queue/Failed/DynamoDbFailedJobProvider.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Ramsey\\Uuid\\Codec\\StringCodec' not found in wp-content/plugins/rest-cache/service/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php:30
    • > PHP Notice
      Undefined variable: factory in wp-content/plugins/rest-cache/service/vendor/jgrossi/corcel/tests/database/factories/CommentFactory.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/rest-cache/service/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\SimpleCache\\CacheInterface' not found in wp-content/plugins/rest-cache/service/vendor/laravel/framework/src/Illuminate/Contracts/Cache/Repository.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)
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
3 plugin tags: rest, cache, rest cache

rest-cache/rest-cache.php 92% from 13 tests

"REST Cache" version 1.0.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
The following require your attention:
  • Description: Please keep the plugin description shorter than 140 characters (currently 285 characters long)

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Almost there! Just fix the following issues
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/rest-cache/service/vendor/swiftmailer/swiftmailer/tests/_samples/smime/ca.crt
      • wp-content/plugins/rest-cache/service/vendor/swiftmailer/swiftmailer/tests/_samples/smime/encrypt.crt
      • wp-content/plugins/rest-cache/service/vendor/swiftmailer/swiftmailer/tests/_samples/smime/encrypt2.crt
      • wp-content/plugins/rest-cache/service/vendor/swiftmailer/swiftmailer/tests/_samples/smime/intermediate.crt
      • wp-content/plugins/rest-cache/service/vendor/swiftmailer/swiftmailer/tests/_samples/smime/sign.crt
      • wp-content/plugins/rest-cache/service/vendor/swiftmailer/swiftmailer/tests/_samples/smime/sign2.crt
    • .bat - Batch File in Windows
      • wp-content/plugins/rest-cache/service/vendor/bin/carbon.bat
      • wp-content/plugins/rest-cache/service/vendor/nesbot/carbon/bin/carbon.bat
      • wp-content/plugins/rest-cache/service/vendor/bin/commonmark.bat
      • wp-content/plugins/rest-cache/service/vendor/perry-rylance/dom-document/generate-documentation.bat
      • wp-content/plugins/rest-cache/service/vendor/bin/php-parse.bat
      • wp-content/plugins/rest-cache/service/vendor/bin/psysh.bat
      • wp-content/plugins/rest-cache/service/vendor/bin/var-dump-server.bat
    • .exe - Executable in Windows
      • wp-content/plugins/rest-cache/service/vendor/symfony/console/Resources/bin/hiddeninput.exe
394,749 lines of code in 4,794 files:
LanguageFilesBlank linesComment linesLines of code
PHP4,38162,823167,720316,667
JSON11319028,655
Markdown1244,350113,473
CSS323,68015411,076
SVG110128,962
HTML51,100585,307
XSD4111482,958
JavaScript315255662,144
yacc3307101,891
reStructuredText87333191,624
Blade32185551,072
YAML15566333
XML10179309
Bourne Shell728582
C1181672
make417449
DOS Batch70025
Vuejs Component12021
Sass34717
Dockerfile29012

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 334)
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity8.83
▷ Minimum class complexity1.00
▷ Maximum class complexity348.00
Average method complexity2.24
▷ Minimum method complexity1.00
▷ Maximum method complexity334.00
Code structure
Namespaces531
Interfaces425
Traits178
Classes2,866
▷ Abstract classes1515.27%
▷ Concrete classes2,71594.73%
▷ Final classes37013.63%
Methods23,045
▷ Static methods1,7687.67%
▷ Public methods17,91777.75%
▷ Protected methods3,72316.16%
▷ Private methods1,4056.10%
Functions3,245
▷ Named functions34910.76%
▷ Anonymous functions2,89689.24%
Constants1,543
▷ Global constants905.83%
▷ Class constants1,45394.17%
▷ Public constants1,38094.98%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
14 PNG files occupy 0.04MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png5.74KB2.08KB▼ 63.82%
lib/images/ui-icons_f9bd01_256x240.png4.57KB4.18KB▼ 8.43%
lib/images/ui-icons_469bdd_256x240.png4.57KB4.18KB▼ 8.43%
lib/images/ui-icons_217bc0_256x240.png4.57KB4.18KB▼ 8.43%
lib/images/ui-bg_inset-hard_100_fcfdfd_1x100.png0.34KB0.10KB▼ 71.14%