83% rest-api

Code Review | WordPress REST API (Version 2)

WordPress plugin WordPress REST API (Version 2) scored 83% from 54 tests.

About plugin

  • Plugin page: rest-api
  • Plugin version: 2.0-beta15...
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6+
  • WordPress version: 6.3.1
  • First release: Apr 25, 2009
  • Latest release: Oct 19, 2016
  • Number of updates: 40
  • Update frequency: every 68.3 days
  • Top authors: danielbachhuber (67.5%)rachelbaker (15%)rmccue (15%)joehoyle (10%)

Code review

54 tests

User reviews

34 reviews

Install metrics

20,000+ active / 510,939 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼4.22ms] Passed 4 tests

This is a short check of server-side resources used by WordPress REST API (Version 2)
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0130.73 ▼22.19
Dashboard /wp-admin3.31 ▲0.0143.48 ▼2.18
Posts /wp-admin/edit.php3.36 ▲0.0148.16 ▲1.78
Add New Post /wp-admin/post-new.php6.79 ▲0.9099.56 ▲5.71
Media Library /wp-admin/upload.php3.23 ▲0.0142.24 ▲7.10

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for WordPress REST API (Version 2)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲4313.31 ▼1.121.88 ▼0.5140.30 ▼32.69
Dashboard /wp-admin2,206 ▲185.91 ▲1.04105.43 ▼1.8142.83 ▼0.03
Posts /wp-admin/edit.php2,089 ▼02.01 ▼0.0340.13 ▲1.8636.50 ▲3.80
Add New Post /wp-admin/post-new.php1,533 ▼123.36 ▲0.22585.93 ▼105.2554.41 ▼14.37
Media Library /wp-admin/upload.php1,388 ▼04.19 ▼0.00108.38 ▲4.1642.78 ▼4.26

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 did not uninstall successfully, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
  • 17× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/rest-api/lib/endpoints/class-wp-rest-revisions-controller.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/rest-api/extras.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/rest-api/core-integration.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/rest-api/lib/endpoints/class-wp-rest-taxonomies-controller.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/rest-api/lib/endpoints/class-wp-rest-terms-controller.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Posts_Controller' not found in wp-content/plugins/rest-api/lib/endpoints/class-wp-rest-attachments-controller.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Meta_Fields' not found in wp-content/plugins/rest-api/lib/fields/class-wp-rest-comment-meta-fields.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/rest-api/lib/endpoints/class-wp-rest-post-types-controller.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/rest-api/lib/endpoints/class-wp-rest-comments-controller.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Meta_Fields' not found in wp-content/plugins/rest-api/lib/fields/class-wp-rest-post-meta-fields.php:3

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

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Tested up to: Version format is invalid
You can look at the official readme.txt

rest-api/plugin.php 85% from 13 tests

Analyzing the main PHP file in "WordPress REST API (Version 2)" version 2.0-beta15...
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("rest-api.php" instead of "plugin.php")
  • Version: The version number should only use digits and periods (ex. "1.0.3" instead of "2.0-beta15...")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin8,890 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
PHP191,1202,0055,645
Markdown31,53702,525
JavaScript2239384720

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.57
Average class complexity57.25
▷ Minimum class complexity1.00
▷ Maximum class complexity274.00
Average method complexity5.48
▷ Minimum method complexity1.00
▷ Maximum method complexity50.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes16
▷ Abstract classes212.50%
▷ Concrete classes1487.50%
▷ Final classes00.00%
Methods203
▷ Static methods20.99%
▷ Public methods14872.91%
▷ Protected methods5527.09%
▷ Private methods00.00%
Functions22
▷ Named functions22100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.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 are no PNG files in this plugin