73% wp-openapi

Code Review | WP OpenAPI

WordPress plugin WP OpenAPI scored73%from 54 tests.

About plugin

  • Plugin page: wp-openapi
  • Plugin version: 1.0.10
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.8-6.0
  • WordPress version: 6.3.1
  • First release: Jul 27, 2022
  • Latest release: May 26, 2023
  • Number of updates: 29
  • Update frequency: every 9.5 days
  • Top authors: moon0326 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

80+ active /3,462 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.60MB] [CPU: ▼7.25ms] Passed 4 tests

This is a short check of server-side resources used by WP OpenAPI
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0333.11 ▼6.93
Dashboard /wp-admin4.47 ▲1.1748.47 ▼0.00
Posts /wp-admin/edit.php4.59 ▲1.2445.31 ▼0.26
Add New Post /wp-admin/post-new.php5.92 ▲0.0478.85 ▼19.60
Media Library /wp-admin/upload.php4.40 ▲1.1738.29 ▼2.19
wp/v2 /wp-admin/admin.php?page=wp-openapi/wp/v24.3936.34
wp-block-editor/v1 /wp-admin/admin.php?page=wp-openapi/wp-block-editor/v14.3734.47
wp-site-health/v1 /wp-admin/admin.php?page=wp-openapi/wp-site-health/v14.3731.88
oembed/1.0 /wp-admin/admin.php?page=wp-openapi/oembed/1.04.3733.62
All /wp-admin/admin.php?page=wp-openapi4.3732.51
WP OpenAPI /wp-admin/options-general.php?page=wp-openapi-settings4.4245.85

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 51 new files
Database: no new tables, 7 new options
New WordPress options
wp-openapi-rewrite-flushed
widget_recent-posts
widget_theysaidso_widget
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP OpenAPI
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,891 ▲14513.60 ▼0.751.93 ▲0.1440.43 ▼2.32
Dashboard /wp-admin2,269 ▲815.97 ▲1.0795.68 ▼11.2836.16 ▲0.44
Posts /wp-admin/edit.php2,155 ▲632.05 ▲0.0535.98 ▼1.9733.16 ▼7.69
Add New Post /wp-admin/post-new.php1,548 ▲2917.42 ▼5.74679.77 ▲100.9757.85 ▲8.53
Media Library /wp-admin/upload.php1,458 ▲704.26 ▲0.10110.07 ▲12.5048.22 ▲2.16
wp/v2 /wp-admin/admin.php?page=wp-openapi/wp/v29707.25233.2457.47
wp-block-editor/v1 /wp-admin/admin.php?page=wp-openapi/wp-block-editor/v19707.20215.6426.59
wp-site-health/v1 /wp-admin/admin.php?page=wp-openapi/wp-site-health/v19737.1096.5128.59
oembed/1.0 /wp-admin/admin.php?page=wp-openapi/oembed/1.09747.1295.1523.49
All /wp-admin/admin.php?page=wp-openapi1,0797.1494.2833.95
WP OpenAPI /wp-admin/options-general.php?page=wp-openapi-settings8572.0728.3335.43

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Zombie WordPress options were found after uninstall: 7 options
    • db_upgraded
    • can_compress_scripts
    • wp-openapi-rewrite-flushed
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not 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 items
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/wp-openapi/resources/views/settings-tryit.php
    • > /wp-content/plugins/wp-openapi/resources/views/settings-discovery.php
    • > /wp-content/plugins/wp-openapi/resources/views/callback.php
  • 8× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Notice
      Undefined variable: callbackType in wp-content/plugins/wp-openapi/resources/views/callback.php on line 6
    • > PHP Notice
      Undefined variable: checked in wp-content/plugins/wp-openapi/resources/views/settings-tryit.php on line 1
    • > PHP Notice
      Undefined variable: checked in wp-content/plugins/wp-openapi/resources/views/settings-discovery.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/wp-openapi/resources/views/settings.php:4
    • > PHP Notice
      Undefined variable: filepath in wp-content/plugins/wp-openapi/resources/views/callback.php on line 13
    • > PHP Notice
      Undefined variable: callbackType in wp-content/plugins/wp-openapi/resources/views/callback.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/wp-openapi/resources/views/export-html.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function WPOpenAPI\\add_action() in wp-content/plugins/wp-openapi/src/SettingsPage.php:52

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following user-side errors
    • > GET request to /wp-admin/admin.php?page=wp-openapi/wp/v2
    • > Network (severe)
    wp-json-openapi?namespace=wp/v2 - Failed to load resource: the server responded with a status of 404 (Not Found)
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wp-openapi
    • > Console-api (severe) in unknown
    /wp-content/plugins/wp-openapi/build/resources/scripts/app.js?ver=822a94ad9fbac7b8e86be5dd14c15446 0:539914 Error: Unable to load description document, status code: 404at /wp-content/plugins/wp-openapi/build/resources/scripts/app.js?ver=822a94ad9fbac7b8e86be5dd14c15446:1:1906444
    • > GET request to /wp-admin/admin.php?page=wp-openapi/wp-block-editor/v1
    • > Network (severe)
    wp-json-openapi?namespace=wp-block-editor/v1 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=wp-openapi/wp-site-health/v1
    • > Network (severe)
    wp-json-openapi?namespace=wp-site-health/v1 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=wp-openapi/oembed/1.0
    • > Network (severe)
    wp-json-openapi?namespace=oembed/1.0 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=wp-openapi
    • > Network (severe)
    wp-json-openapi?namespace=all - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 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
5 plugin tags: swagger, rest api, documentation, api, openapi

wp-openapi/wp-openapi.php Passed 13 tests

The main file in "WP OpenAPI" v. 1.0.10 serves as a complement to information provided in readme.txt and as the entry point to the plugin
93 characters long description:
WP OpenAPI outputs the OpenAPI 3.1.0 spec and provides a viewer for your WordPress REST APIs.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin1,917 lines of code in 46 files:
LanguageFilesBlank linesComment linesLines of code
PHP353975771,770
Markdown141073
JavaScript48530
JSON20024
Sass13017
CSS3003

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity9.04
▷ Minimum class complexity1.00
▷ Maximum class complexity48.00
Average method complexity2.07
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces6
Interfaces0
Traits0
Classes23
▷ Abstract classes00.00%
▷ Concrete classes23100.00%
▷ Final classes00.00%
Methods148
▷ Static methods2315.54%
▷ Public methods13691.89%
▷ Protected methods00.00%
▷ Private methods128.11%
Functions21
▷ Named functions00.00%
▷ Anonymous functions21100.00%
Constants6
▷ Global constants116.67%
▷ Class constants583.33%
▷ Public constants5100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
PNG images were not found in this plugin