84% wp-api-swaggerui

Code Review | WP API SwaggerUI

WordPress plugin WP API SwaggerUI scored84%from 54 tests.

About plugin

  • Plugin page: wp-api-swaggerui
  • Plugin version: 1.1.2
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.9
  • WordPress version: 6.3.1
  • First release: Jul 29, 2019
  • Latest release: Jul 10, 2022
  • Number of updates: 21
  • Update frequency: every 51.3 days
  • Top authors: agussuroyo (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

3,000+ active /37,156 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.10MB] [CPU: ▼7.10ms] Passed 4 tests

Analyzing server-side resources used by WP API SwaggerUI
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.1037.86 ▼6.73
Dashboard /wp-admin3.40 ▲0.1048.10 ▼0.65
Posts /wp-admin/edit.php3.52 ▲0.1648.29 ▼1.33
Add New Post /wp-admin/post-new.php5.98 ▲0.1086.23 ▼19.68
Media Library /wp-admin/upload.php3.33 ▲0.1039.82 ▲4.10
Swagger /wp-admin/options-general.php?page=swagger-ui4.4337.78

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
db_upgraded
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP API SwaggerUI
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5714.28 ▼0.011.77 ▼0.6841.06 ▼4.99
Dashboard /wp-admin2,199 ▲345.66 ▲0.0899.12 ▲9.0042.32 ▼5.20
Posts /wp-admin/edit.php2,104 ▲12.03 ▲0.0539.94 ▼0.9534.78 ▼5.85
Add New Post /wp-admin/post-new.php1,531 ▼422.97 ▲4.67638.22 ▲17.5357.49 ▼27.95
Media Library /wp-admin/upload.php1,404 ▲44.18 ▼0.0198.20 ▼11.1446.20 ▼0.94
Swagger /wp-admin/options-general.php?page=swagger-ui8352.1423.3826.22

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
The following issues need your attention
  • 7× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/wp-api-swaggerui/template/notice.php:2
    • > PHP Notice
      Undefined variable: page_title in wp-content/plugins/wp-api-swaggerui/template/setting.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function language_attributes() in wp-content/plugins/wp-api-swaggerui/template/single.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-api-swaggerui/swaggertemplate.php:78
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-api-swaggerui/swaggersetting.php:52
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/wp-api-swaggerui/swaggerauth.php:96
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/wp-api-swaggerui/template/setting.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
10 plugin tags: wp swagger, swaggerui, swaggerui rest api, wp swaggerui, wp rest api...

wp-api-swaggerui/wp-api-swaggerui.php Passed 13 tests

The main PHP file in "WP API SwaggerUI" ver. 1.1.2 adds more information about the plugin and also serves as the entry point for this plugin
35 characters long description:
WordPress REST API with Swagger UI.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected607 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP1015431603
CSS1003
JavaScript1001

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity18.60
▷ Minimum class complexity5.00
▷ Maximum class complexity59.00
Average method complexity2.58
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods48
▷ Static methods714.58%
▷ Public methods4797.92%
▷ Protected methods00.00%
▷ Private methods12.08%
Functions3
▷ Named functions00.00%
▷ Anonymous functions3100.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
No PNG images were found in this plugin