84% better-rest-endpoints

Code Review | Better Rest Endpoints

WordPress plugin Better Rest Endpoints scored84%from 54 tests.

About plugin

  • Plugin page: better-rest-endpo...
  • Plugin version: 1.5.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7.1-4.9.9
  • WordPress version: 6.3.1
  • First release: Jan 19, 2018
  • Latest release: Feb 13, 2019
  • Number of updates: 37
  • Update frequency: every 10.7 days
  • Top authors: factor1 (70.27%)erwstout (32.43%)

Code review

54 tests

User reviews

1 review

Install metrics

300+ active /2,751 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
Install script ran successfully

Server metrics [RAM: ▼0.42MB] [CPU: ▼14.49ms] Passed 4 tests

A check of server-side resources used by Better Rest Endpoints
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.73 ▲0.2738.46 ▼13.10
Dashboard /wp-admin3.56 ▲0.2651.27 ▲1.34
Posts /wp-admin/edit.php3.67 ▲0.3245.51 ▲1.53
Add New Post /wp-admin/post-new.php3.44 ▼2.4537.65 ▼47.72
Media Library /wp-admin/upload.php3.48 ▲0.2634.57 ▲2.46

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

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

Browser metrics Passed 4 tests

Better Rest Endpoints: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲9013.73 ▼0.641.77 ▼0.4638.13 ▼15.27
Dashboard /wp-admin2,206 ▲214.87 ▼0.03102.61 ▼13.3042.02 ▼3.70
Posts /wp-admin/edit.php2,089 ▲32.01 ▼0.0338.73 ▲3.5031.37 ▼3.75
Add New Post /wp-admin/post-new.php1,533 ▲1423.32 ▼0.01639.54 ▼54.5957.85 ▲2.95
Media Library /wp-admin/upload.php1,391 ▲34.18 ▼0.0399.92 ▼6.0742.59 ▼2.90

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 16× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/get_posts.php:188
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/wp_nav_menus_by_location.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/get_search.php:180
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/create_cpt_endpoints.php:265
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/get_pages.php:168
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/get_cpt_by_slug.php:136
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/wp_nav_menus.php:65
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/get_post_by_slug.php:131
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/get_posts_tax.php:287
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-rest-endpoints/includes/wp_nav_menus_by_name.php:65

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

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
5 plugin tags: endpoints, rest, json, acf, api

better-rest-endpoints/better-rest-endpoints.php 92% from 13 tests

The main PHP file in "Better Rest Endpoints" ver. 1.5.2 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Domain Path: The domain path folder does not exist ("/languages")

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
Good job! No executable or dangerous file extensions detected2,041 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code
PHP214657071,625
Markdown21090343
JSON20073

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity3.00
▷ Minimum class complexity3.00
▷ Maximum class complexity3.00
Average method complexity1.67
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods3
▷ Static methods133.33%
▷ Public methods133.33%
▷ Protected methods00.00%
▷ Private methods266.67%
Functions87
▷ Named functions2225.29%
▷ Anonymous functions6574.71%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG images were found in this plugin