83% rest-api-blocks

Code Review | REST API blocks

WordPress plugin REST API blocks scored 83% from 54 tests.

About plugin

  • Plugin page: rest-api-blocks
  • Plugin version: 1.0.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.2
  • WordPress version: 6.3.1
  • First release: Aug 11, 2021
  • Latest release: Apr 20, 2023
  • Number of updates: 12
  • Update frequency: every 51.5 days
  • Top authors: spacedmonkey (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active / 2,058 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.18MB] [CPU: ▼2.59ms] Passed 4 tests

An overview of server-side resources used by REST API blocks
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1746.88 ▲6.05
Dashboard /wp-admin3.53 ▲0.2346.82 ▼4.62
Posts /wp-admin/edit.php3.58 ▲0.2351.13 ▼1.12
Add New Post /wp-admin/post-new.php6.06 ▲0.1788.29 ▼5.70
Media Library /wp-admin/upload.php3.39 ▲0.1638.77 ▲1.07

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 135 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for REST API blocks
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲9013.18 ▼1.192.08 ▲0.1443.09 ▼2.32
Dashboard /wp-admin2,203 ▲155.80 ▼0.0599.42 ▼3.1242.35 ▲0.67
Posts /wp-admin/edit.php2,089 ▼02.04 ▼0.0137.68 ▼4.6236.37 ▼2.88
Add New Post /wp-admin/post-new.php1,533 ▲1923.40 ▲5.98663.56 ▼11.3353.93 ▼3.63
Media Library /wp-admin/upload.php1,388 ▼04.23 ▼0.0096.62 ▼11.3943.29 ▼2.03

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 107× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installer\\LibraryInstaller' not found in wp-content/plugins/rest-api-blocks/vendor/composer/installers/src/Composer/Installers/Installer.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'pQuery\\TokenizerBase' not found in wp-content/plugins/rest-api-blocks/vendor/tburry/pquery/gan_parser_html.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'pQuery\\TokenizerBase' not found in wp-content/plugins/rest-api-blocks/vendor/tburry/pquery/gan_selector_html.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-blocks/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-blocks/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-blocks/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-blocks/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-blocks/vendor/composer/installers/src/Composer/Installers/ProcessWireInstaller.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-blocks/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-blocks/vendor/composer/installers/src/Composer/Installers/AglInstaller.php:4

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 90% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: wp-json, rest-api, blocks, api, gutenberg

rest-api-blocks/wp-rest-blocks.php 77% from 13 tests

Analyzing the main PHP file in "REST API blocks" version 1.0.0
Please take the time to fix the following:
  • Requires PHP: Required version does not match the one declared in readme.txt ("7.0.0" instead of "7.0")
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("rest-api-blocks.php" instead of "wp-rest-blocks.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis 97% from 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 plugin8,251 lines of code in 128 files:
LanguageFilesBlank linesComment linesLines of code
PHP1271,5263,3788,032
JSON100219

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
Please fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 155)
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity11.92
▷ Minimum class complexity1.00
▷ Maximum class complexity312.00
Average method complexity4.19
▷ Minimum method complexity1.00
▷ Maximum method complexity155.00
Code structure
Namespaces8
Interfaces1
Traits0
Classes130
▷ Abstract classes10.77%
▷ Concrete classes12999.23%
▷ Final classes00.00%
Methods476
▷ Static methods245.04%
▷ Public methods34973.32%
▷ Protected methods10321.64%
▷ Private methods245.04%
Functions28
▷ Named functions2175.00%
▷ Anonymous functions725.00%
Constants153
▷ Global constants9864.05%
▷ Class constants5535.95%
▷ Public constants55100.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
There were not PNG files found in your plugin